-->
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: dirty collection
PostPosted: Wed Feb 15, 2006 3:05 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
I use @Version for Student that has a list of courses that do not have @Version.

@Entity
Class Student {


....

List<Course> getCourses();

@Version
public Integer getVersion() {
}

}

@Entity
Class Course {

}

When I added a course to a student, then increase the student's version without reloading the student from database to match the version in database.

The Student has other lazy property, so at some point I used
session.lock(student, LockMode.NONE);
to connect the detached entity to session in order to fetch lazy properties.

But I got exception:
"entity has dirty collection"

How Lock works? How does Hibernate know dirty collection? In term of version, they match version in persistence.

Thanks for help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 4:33 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
It happend without @Version too.

@OneToMany relation

create one course, persist it
add it to collection, and then
merge the owning entity Student

No issue.
but session.lock(student, LockMode.NONE)

throw:
org.hibernate.HibernateException: reassociated object has dirty collection

Thanks for ideas.


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.