-->
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: Design question/Session lifetime
PostPosted: Thu Mar 03, 2005 6:42 am 
Newbie

Joined: Thu Mar 03, 2005 6:28 am
Posts: 1
Hi, I've got the following situation:

- on application startup a list of user objects got fetched from the database

- later a meeting object got fetched from the database, containing a list of
attending users. These users are other user objects than the ones loaded on
startup, because the meeting got loaded in its own session.

- now the meeting gets modified. for every modification a history message is
added to the meeting, containing a timestamp and the current logged in user
(which is obviously an user object from the list fetched at application startup).

- when trying to store the modified meeting to the database, hibernate throws
the following exception: "a different object with the same identifiert value was
already associated with the session". hibernate's right here, there are user
objects from the global user list fetched at startup and user objects fetched
with the meeting pointing to the same identifier.

What would be the appropriate solution ? I need this global user list for
speed reasons. Do I have to sess.update() every global user object every
time a new session gets created ? Or should I use just one session over the
whole application lifetime ? The FAQ states to use a session per database
transaction, but what about long lasting objects from previous transactions ?
Or is my application "broken by design" ?

Regards,
Axel


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.