-->
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: Finding dirty objects present in a hibernate session
PostPosted: Tue Dec 12, 2006 10:08 am 
Newbie

Joined: Mon Dec 11, 2006 1:06 am
Posts: 5
Hi,

I need to find all the dirty objects present in a hibernate session. Is there any way to find the list of dirty objects?

TIA
Jothi


Top
 Profile  
 
 Post subject: Track it yourself using setters
PostPosted: Tue Dec 12, 2006 2:41 pm 
Beginner
Beginner

Joined: Thu Apr 27, 2006 12:19 pm
Posts: 33
Location: Seattle, WA
Unfortunately there isn't a method like: session.getDirtyObjects(). It appears to me that Hibernate figures out which objects are dirty at the identitymap level during a flush. What I've done before is fixed up all the setters of my classes, for example:

private boolean changed = false;
private String firstName;

public void setFirstName(String firstName)
{
setChanged(this.firstName != firstName);
this.firstName = firstName;
}

protected void setChanged(boolean changed)
{
if (changed)
this.changed = changed;
}


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.