-->
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: Hibernate always uses db id to see if an obj is detached???
PostPosted: Thu Sep 14, 2006 5:55 pm 
Newbie

Joined: Fri Nov 04, 2005 11:42 am
Posts: 13
Hi

Does hibernate always use the database identifier to figure out if an object is a detached one when I try to update an object thats present in the database? Is it possible for hibernate to use the java equality for that???

Okay, here is my problem. I have an object passed to the presentation layer for any edits to it by a user. I dont want to expose the database id to the user and hence I dont keep the db id in any hidden inputs on my .jsp page. Once the user is done with the edits, Webwork(using webwork in my project), creates a new object with the edits of the user. Once I pass that object to Hibernate for updating, I want hibernate to figure out that it relates to an object in the database even if the db id for this new object is null, by using java equality (I have implemented equals() & hashCode() method for this class using the business key). Is that possible at all???

Thanks a lot,
Neha.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 8:58 pm 
Newbie

Joined: Mon Aug 01, 2005 8:12 pm
Posts: 19
Location: CA
What do you mean by "database identifier".

In your hibernate pojo there is no database information stored.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 9:04 pm 
Newbie

Joined: Fri Nov 04, 2005 11:42 am
Posts: 13
By database identifier I mean, the property that is mapped to "<id>" in the .hbm.xml file.

Neha.


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.