-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate ORA-01747
PostPosted: Tue Jan 26, 2010 9:04 am 
Newbie

Joined: Thu Sep 10, 2009 5:43 am
Posts: 15
Hello,
I have hibernate 3.3 with oracle 10g
I try do object query. Hibernate generates:
select table1_.NUMBER from table table1_ and I get ORA-01747, because NUMBER is the key work in oracle. I can execute SQL query select table1_."NUMBER" from table table1_ by adding quotas and its ends success. How to configure hibernate to autaomaticly add quotas to column

Thea same problem:
https://forums.hibernate.org/viewtopic. ... 1bee455978

Best regards


Top
 Profile  
 
 Post subject: Re: Hibernate ORA-01747
PostPosted: Tue Jan 26, 2010 9:12 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Add backticks around the column name in your mapping/annotation. For example:
Code:
<property name="foo" column="`NUMBER`" ...>


See http://docs.jboss.org/hibernate/stable/ ... dentifiers


Top
 Profile  
 
 Post subject: Re: Hibernate ORA-01747
PostPosted: Tue Jan 26, 2010 9:19 am 
Newbie

Joined: Thu Sep 10, 2009 5:43 am
Posts: 15
Thanks for replay.
But I cannot understand why in hibernate dialect don't generates this automaticly in his sql query.
Because how I can migrate from Oracle(which use "") to MSSQL(which use {}) now I must correct my all hbm files.


Top
 Profile  
 
 Post subject: Re: Hibernate ORA-01747
PostPosted: Tue Jan 26, 2010 9:33 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I think that one reason is that the behavior of some databases is different if the names are quoted and if they are not. For example, a database may decide to convert all unquoted names to upper or lower case, which may mean that select * from some_table and select * from "some_table" not are equivalent. It can really be a mess and there is no way for Hibernate to assume that one way is more correct than the other. If you need portability between different databases I think the best bet is to use quoted names. Hibernate will automatically replace the backticks with the correct quote character.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.