-->
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: primary key field confusion
PostPosted: Mon May 15, 2006 2:09 pm 
Newbie

Joined: Fri May 12, 2006 12:04 pm
Posts: 5
I've posted this question in the EJB 3.0 Persistence forum but I think it is a general Hibernate problem.
Basically I have a class with two fields: id and uuid. Uuid is the primary key field. When I write a Hibernate query that references the id field, it gets translated into the uuid field.

See this thread for details:
http://forum.hibernate.org/viewtopic.php?t=959372


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 17, 2006 3:12 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
There is no way around it: 'id' has specific meaning in the Hibernate's HQL, that is why it gets resolved into uuid.

You need to have a different name (or accessors) for that 'id' field for Hibernate to work with it.

Simplest way is to rename 'id' to something like 'businessId'

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 3:03 pm 
Newbie

Joined: Fri May 12, 2006 12:04 pm
Posts: 5
Thanks for your answer.
However, I'm using the EntityManager and EJBQL 3.0. Does 'id' also have a predefined meaning in EJB 3.0?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 5:37 pm 
Newbie

Joined: Fri May 12, 2006 12:04 pm
Posts: 5
kgignatyev wrote:
Simplest way is to rename 'id' to something like 'businessId'


Renaming is not an option. What else can I do?


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.