-->
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: Problem with detached objects when use assigned gen class
PostPosted: Sat Feb 26, 2005 7:50 am 
Newbie

Joined: Sat Feb 26, 2005 7:34 am
Posts: 14
Location: Bangalore, India
Hi All,
I am using Hibernate 2.1.7. I have lot of legacy data. So I cannot generate a new Id in each table. So I started using assigned generator class. I heard that there will be some problems with detached objects, if we use assigned generator class. Is there any solution to avoid this. Please help me to get out from this confusion.
Thanks,
Kumar.


Top
 Profile  
 
 Post subject: Re: Problem with detached objects when use assigned gen clas
PostPosted: Sat Feb 26, 2005 4:14 pm 
Regular
Regular

Joined: Thu Dec 18, 2003 2:14 am
Posts: 103
Location: Brooklyn, NY
Rotte Sripad Kumar wrote:
I heard that there will be some problems with detached objects, if we use assigned generator class

Could you be more specific about the potential problem? Post a link or summarize the issue you heard of.

Offhand, I don't think assigned ids are the right way to go if you can't persist them. This would certainly lead to nasty detached issues, and tons of others.

Use composite-id to assemble an unique id from the persisted values of the row.


Top
 Profile  
 
 Post subject: Assigned Generator Class
PostPosted: Sun Feb 27, 2005 2:55 am 
Newbie

Joined: Sat Feb 26, 2005 7:34 am
Posts: 14
Location: Bangalore, India
Hi!,
We are migrating our database from SQL Server to Oracle, meanwhile we decided to use hibernate. We cannot add extra id column to the database tables. We must use the existing primary-key as id in our case.

Hibernate supports assigned generator class to support this. But hibernate-reference.pdf document or hibernate in action book says if we use assigned generator we will be in troubles while working with detached objects/Trancient Persistence.

Is there any other generator class which will accomplish my requirement.
Thanks,
Kumar.


Top
 Profile  
 
 Post subject: Re: Assigned Generator Class
PostPosted: Sun Feb 27, 2005 10:36 am 
Regular
Regular

Joined: Thu Dec 18, 2003 2:14 am
Posts: 103
Location: Brooklyn, NY
Rotte Sripad Kumar wrote:
We must use the existing primary-key as id in our case.

Ah, I didn't know you had a PK field! Good.

Again, I'm not sure the issue you are worried about, so if you could be more clear it would help. Perhaps it is this one (and the solution):

http://www.hibernate.org/116.html#A11


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.