Skip to content

NH-2892 - The <key /> columns containing reserved words are not quoted #1100

Closed
@nhibernate-bot

Description

@nhibernate-bot

Christian Ista created an issue — 18th September 2011, 9:24:03:

Hello,

I have a classic Order and OrderLine tables. When I get an order when I try to load the OrderLines I receive an exception. The code look correct and the NHProf log show me an error in the query.

I join the NHProf log.

The mapping is for Order object :

    <set name="OrderLines" table="OrderOrderLine" inverse="true" cascade="all-delete-orphan" >
      <key column="Order" />
      <one-to-many class="OrderLine" />
    </set>

and

OrderLine object :

<many-to-one name="Order" column="Order" not-null="true" />

Christian Ista added a comment — 18th September 2011, 11:46:43:

I replaced in project Order by Purchase and OrderLine by PurchaseLine and no more problem, there is a bug somewhere. HTH


sbohlen added a comment — 18th September 2011, 12:48:30:

"Order" is a reserved word in most relational databases. Are you certain that you are properly escaping reserved words? Since your mapping snippet doesn't show you explicitly escaping reserved words (e.g., you have <key column="Order" /> rather than <key column="Order" />), can you ensure that you are properly using the <property name="hbm2ddl.keywords">auto-quote</property> value in your hibernate.cfg file?


Christian Ista added a comment — 18th September 2011, 13:13:49:

Yes I use <property name="hbm2ddl.keywords">auto-quote</property> in the config file. In the past (with other version of NH) I used Order and OrderLines without any problem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions