-->
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: handling shared references
PostPosted: Tue Jan 27, 2004 11:04 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hey folks,

just a question.
I work at framework which frequently uses KeyValueTuples similar to HashMaps.
The key is a string, the value an Object.
The value could be a KeyValueTuple too, so it comes to an amount of
circular/shared references.

Code:
fe:
TransportMessage (it is a hibernate class standing in one-to-many relationship with KeyValueTuple )

transportMessage A = transportMessage B;

->all underlaying KeyValueTuples are obtained by both TransportMessages, if one clears his KeyValueTuple collection, the other had a problem

i could handle this by creating every time new instance of TransportMessage and assign the new KeyValueTuple and so on...

My Question is, if there are common ways to handle that ??


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2004 7:21 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Lets make an example.

I had an registry, where i could register and deregister a hibernate class.
A client could search the registry and get some of the registered hibernate objects.

Now, when the client modify and save one of these objects, he shouldn't overwrite the object the registry holds reference to.


possible solutions:

I could set the identifier of the object to null, when the registry give them to the client, whats difficult, because the object has an large object graph.

The client could save an replicate of the object with replicate() , then modify it and then save it in normal way.

Any other suggestions?


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.