-->
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: Limitations of PersistentSet
PostPosted: Wed Dec 19, 2007 5:07 pm 
Newbie

Joined: Wed Dec 19, 2007 4:42 pm
Posts: 3
We just came across a serious limitation in Hibernate especially in a distributed programming environment such as GWT-RPC or SOA.

In our scenario Hibernate is not able to recognize collection objects once they travel over network (serialized). So, it ends up deleting all the previous entries in the database and recreates them again based on the collection passed in.

We currently convert PersistentSet into HashSet and serialize it for sending to GWT client. When the same set come back to server for persistence, Hibernate is not able to recognize the objects in the HashSet. So, it ends up deleting all the entries and recreating them again. This is not acceptable behavior thus forcing us to manage Collections using custom coding efforts.

It appears this is a limitation in how the collections are implemented in Hibernate because it assumes all the objects or collection objects reside in the same JVM for their entire life. Whatever happened to the distributed computing such as SOA/CORBA/GWT-RPC??

Any simple work-around or a clean solution would be highly appreciated.
MA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 5:51 pm 
Newbie

Joined: Tue Dec 18, 2007 1:40 pm
Posts: 6
I'm going to go out on a limb here and say that you didn't override equals/hashcode? After serialization collections cannot tell the difference between objects if you haven't implemented the objects in this fashion.


Top
 Profile  
 
 Post subject: Equals/Hashcode
PostPosted: Wed Dec 19, 2007 6:11 pm 
Newbie

Joined: Wed Dec 19, 2007 4:42 pm
Posts: 3
Nice try! I checked for it. Unfortunately Hibernate is looking for the exact object reference with == operator.
please refer: http://www.hibernate.org/116.html#A15


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 6:24 pm 
Newbie

Joined: Tue Dec 18, 2007 1:40 pm
Posts: 6
Touche. I wonder if this has to do with not forcing versioning / version cascading in models.


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.