Or better yet, do not use tables that are known reserved words (including
other potential RDBMS systems). Even though the information from Steve will
address this particular issue, there are likely to be other problems down
the road (especially when other applications/tools need to work with the DB
schema!)

 

 

From: [email protected] [mailto:[email protected]] On Behalf
Of sbohlen
Sent: Tuesday, December 20, 2011 10:11 AM
To: [email protected]
Subject: [nhusers] Re: Set brackets in query

 

Actually, you don't want square brackets [ ] because that is an escape
sequence specific to SQL Server and won't be portable across different
databases (one of the points of an ORM like NH).  Instead, you want the `
(back-tick) which is what NH uses to escape reserved words in a DB-portable
manner.  So instead of [User] you actually want `User`.

You can either do this on a case-by-case basis (if you are using XML mapping
files) or set it globally in the hibernate.cfg file by adding the following
entry: <property name="hbm2ddl.keywords">auto-quote</property>

-Steve B.

-- 
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/IY4BgpO9dboJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to