-->
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: Using property named "id" in HQL
PostPosted: Tue Oct 19, 2004 9:34 am 
Newbie

Joined: Tue Oct 19, 2004 9:29 am
Posts: 2
How can I use property named "id" in HQL?
Ve primary key name is not "id", but "uniqueId", so when I use query like "from MyObject o where o.id=value " Hibernate generates SQL code like " where tblname.uniqueId=value ". Is there any way to make Hibernate not to substitute primary key insted of id in HQL queries?

I am using Hibernate 2.1.6 with MySQL 4.0+


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 12:41 pm 
Beginner
Beginner

Joined: Fri Aug 13, 2004 3:07 pm
Posts: 44
I may be missing something here but I thnk the query should read as

from MyObject as o where o.id=value

_________________
Thanks
Sameet


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 12:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, there is no way - don't name your properties "id" :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 12:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
id is a "reserved" word in HQL...


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.