-->
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: Flash Remoting - Detached Object
PostPosted: Tue Nov 07, 2006 2:40 pm 
Newbie

Joined: Tue Sep 19, 2006 4:13 am
Posts: 18
Hibernate 3.0


Brief : My application uses: Flash Remoting (AMF) with Java+Hibernate. My domain objects get serialized/deserialzed via Flash Gateway. As per the design practice - we just pass the basic Domain object (i.e minus all assosiations) to & fro , barring some exceptional cases.We make the reassosiations on AS side. Though in java layer i do manuplate the whole object graph. (Cascades for each assosiation have been defined as per requirement - dont want changes here)

Case: Say, I have an object A which has a lazy association collection B (1:m) , now i go thru following steps:
1) Load A
2)Pass it to Flash //Detached state
3)Make some modifications on A
4)Pass it back to Hibernate and reassosiate it with session by update() or whatever. //Reasssocciated
5)Flush / tx.commit() // Db hit

Hibernate deletes the collection B while updating A. This is fine and exceptable since the Flash Gateway serilizes the requested object A from AS to Java , and in the process nullifies the collection which is never.

Workarounds: There are couple of things we can do but with payoffs , like link B with A (but this would cause n/w latency for obvious reasons ) , second , we can pull the same object from db (by id) and sort of overwrite it by the basic A properties , something like dynamic update (but this an extra round trip)

Issue:
1) Is there a better solution? am i missing on something ?
2) Can we ask Hibernate to reattach an object forcefully without a dirty check - this might also be useful for the users interested in different clients /rich clients (otherthan -java or .Net) which would also function in the similar fashion and have own native way of serializaation/deserialization of object graphs.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 07, 2006 3:29 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Did you try session.merge?

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 3:47 am 
Newbie

Joined: Tue Sep 19, 2006 4:13 am
Posts: 18
This will surely not help, ill surely check though.

session.merge or select_before_update are basically ment for "merge" purpose , that means they will read an entity from DB(if not in session) and commit your changes on it.

The problem is that the Hibernate is looking it as a change, since actually it is a change.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 4:03 am 
Newbie

Joined: Tue Sep 19, 2006 4:13 am
Posts: 18
As expected this didnt help.


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.