-->
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.  [ 3 posts ] 
Author Message
 Post subject: Persistent object transferred via Session
PostPosted: Mon Feb 09, 2004 10:37 am 
Beginner
Beginner

Joined: Thu Feb 05, 2004 4:59 am
Posts: 23
1) I create Hibernate's object using:
MyObject object = new MyObject(...);
2)Then i save it in HttpSession attribute:
session.addAttribute("object", object);
3) This object transfered from servlet to servlet, sometimes, the fields of this object becomes changed. At the ending, i do in one of my servlets:
Object obj = session.getAttribute("object");
Session sess = HibernateUtil.currentSession();
MyObject object = (MyObject)obj;
sess.save(object);
sess.flush();

4) I repeat steps 1-3 several times, but on 3rd or 4th try i receive an exception:
objectnet.sf.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

I'm using ONLY one session object at one time ! How it could happens ???


Top
 Profile  
 
 Post subject: Re: Persistent object transferred via Session
PostPosted: Mon Feb 09, 2004 10:39 am 
Beginner
Beginner

Joined: Thu Feb 05, 2004 4:59 am
Posts: 23
Ooooooooops, i forgot to invoke closeSession() method...i think that's the reason....let's see...


Top
 Profile  
 
 Post subject: Re: Persistent object transferred via Session
PostPosted: Mon Feb 09, 2004 10:43 am 
Beginner
Beginner

Joined: Thu Feb 05, 2004 4:59 am
Posts: 23
Shit ! What a stupid mistake !

Solved...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.