-->
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.  [ 1 post ] 
Author Message
 Post subject: question about contains method from Session
PostPosted: Mon Jun 29, 2009 3:15 pm 
Newbie

Joined: Wed Jun 17, 2009 6:02 am
Posts: 4
hi,

i have a question about, in particular i'd like to know, whether i do understand the purpose if this method correctly.

a Session is a first level cache and it memorizes the objects that working with the session (are associated with the session).
if i want to associate an object twice i get the NonUniqueObjectException, if i use a transient or detached object without
associating it with a session, i get a 'No session' exception when i want to refresh the object or access associated object from
this object (i.e. relations in the database).

if an object is associated with a session, the contains(object) method is supposed to return 'true', isn't it?

i've run into serious problems in my application because somehow the method does not always return the correct value.
if the contains() method returns 'false' i try to get a lock on the obect, thus reassociating it with the current new session,
but on many occasions i get a NonUniqueObjectException allthough the contains method returned 'false', thus rendering the session useless.

the method uses the equals() method of the objects to check for existing associated objects?!??!

this is really a problem because i need a reliable mechnism to check whether a object is already associated to reattach it or not.


i didn't find a solution anywhere and i'm not experienced with hibernate, so some help here from some experienced users would be great!!

thx in advance,

greetings,
-ben


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.