-->
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.  [ 2 posts ] 
Author Message
 Post subject: Recursive Object Updation, Kindly advice
PostPosted: Sat Oct 20, 2007 8:56 am 
Newbie

Joined: Wed Sep 05, 2007 2:26 am
Posts: 5
Hello,

I have 2 different objects dbobj and xmlobj, both are objects of
same Class and dbobj.equals(xmlobj) is false.

dbobj is read from database with hibernate.
xmlobj is an object created from an xml file.

Now i have to Sync dbobj in such a way that, dbobj gets updated
with all the new values present in xmlobj (excepting primary key).

It works fine if i update the primary key on xmlobj (taken from the
dbobj's primary key) and save xmlobj. I have understood that if the
Class has reference to Children then all those child objects' primary
keys needs to be updated from dbobj to xmlobj, otherwise new rows
will be created for those children and earlier children objects will loose
their reference.

I have come up with a class, which recurses the dbobj and collects
all the children's primary keys and updates the xmlobj accordingly
and it works fine now. However, if i have a child of type List/Collection
my code fails for those children.

I cant think of any other solution for achieving the same for collection
based Objects(children) and feel all the roads are blocked for me. This
is the heart of the project i work on and i find no other way.

Kindly, advice me if there is any other/better way to do it or any
simple way in hibernate which already does this.

Thank you all of you people who are involved in development,
administration, support and all whoever involved actively or passively,
for such a great great project. Thanks a lot!!

Thanks in advance,
Regards,
Sanjeev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 22, 2007 4:39 am 
Newbie

Joined: Wed Sep 05, 2007 2:26 am
Posts: 5
Hai,

Eagerly waiting for an update/advice on this. Hasn't anyone
come across such situation yet!?

Thanks and Regards,
Sanjeev


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.