-->
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: Error when re-associating an existing object with a session
PostPosted: Thu Nov 06, 2003 3:03 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
Hello,

I have the object retrieved from a previous session and try to load its lazy collection in a new session:

try {
PersistentSession session = new PersistentSession();
if (!Hibernate.isInitialized(((NetPortalProvider)node).getNetworks()))
{
session.getPersistentSession().lock(((NetPortalProvider)node), LockMode.NONE);
Hibernate.initialize(((NetPortalProvider)node).getNetworks());
}
}
catch(Exception e) {
return null;
}

(PersistentSession is a wrapper for a Hibernate session)

I get this exception on the highlighted line:
"reassociated object has dirty collection reference"

Anyone knows what this means?

TIA,

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2003 9:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
It means that there are changes to the state of a collection that you just truid to reassociate with lock().

Lock() is for "clean" objects. update() is for dirty ones.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2003 9:57 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
Thanks, Gavin. I'll re-write that stuff.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 9:53 am 
Beginner
Beginner

Joined: Tue Jan 08, 2008 2:15 pm
Posts: 22
That is confirmed, on page 118 of the HB reference doc v3.2.2:

"The lock() method also allows an application to reassociate an object with a new session. However, the detached
instance has to be unmodified!"


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.