-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Quotes in SQL
PostPosted: Mon Apr 10, 2006 6:07 am 
Newbie

Joined: Thu Apr 06, 2006 1:17 am
Posts: 6
Location: Copenhagen, Denmark
Hello all,

Can somebody explain why SQL identifier quotes are not always added automatically to column names by NHibernate, so we don't have to specify it manually when using reserved words as column names?

Identifier quotes are different between for example MSSQL's [] and MySQL's `` , so I need to make two mapping-files in order to share the same class-model between multiple databases.

It would be very nice it it was possible to instruct NHibernate to just add it automatically, so it's completely db-independent :-)

thanks,
Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 9:41 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
I assume you mean HQL?

You should use backticks. Each dialect will convert this to the correct quote types for the desired DB.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 2:31 pm 
Newbie

Joined: Thu Apr 06, 2006 1:17 am
Posts: 6
Location: Copenhagen, Denmark
ah, I see... :-)

I wasn't aware that I could use backticks in the mapping file when using the MSSQL dialect. It's great that NH translates these quotes.

(actually I didn't talk about HQL, but the column names in the mapping file and the SQL statements that NH generates in general)


thanks a lot,
Jonas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.