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: Session dirty objects
PostPosted: Wed Nov 04, 2009 8:45 am 
Newbie

Joined: Thu Jun 26, 2008 3:35 am
Posts: 3
Is there any way to find out all the dirty objects of a given session?


Top
 Profile  
 
 Post subject: Re: Session dirty objects
PostPosted: Wed Nov 04, 2009 9:13 am 
Newbie

Joined: Wed Nov 04, 2009 8:43 am
Posts: 2
I dont think that hibernate provide direct method to find dirty objects, however you may do this by extending EmptyInterceptor. something like this.

public class myAuditLogInterceptor extends EmptyInterceptor{
private Set dirtyAuditables = new HashSet();
public boolean onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException {

dirtyAuditables .add(entity);
return false;
}

}

the size of the dirtyAuditable will tell you the no of dirty objects that are found in a particular session.


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.