-->
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: Dirtychecking doesn't allow to get the modified properties??
PostPosted: Thu Dec 06, 2007 5:46 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
What i want to do is to get the Names of the properties which have been modified before executing an update...
For this
I use an interceptor which extends EmptyInterceptor

When i update an instance, the method findDirty() & onFlushDirty() are called but :
- in findDirty(), the previousState and the currentState are equal!!! so i can't get the indice of the dirty properties,

- in onFlushDirty(), the previous state is null....

Can anybody help me?? Cause i'm really convince that interceptor can achieve this function i want...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 8:47 am 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
I use Hibernate 3...

I always got currentState = previousState in findDirty() function
Then the function is useless...

Code:
   <bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource" ref="dataSource" />
      <property name="entityInterceptor" ref="findDirtyFields" />
....



Code:
public class FindDirtyFields extends EmptyInterceptor {

   @Override
   public int[] findDirty(Object entity, Serializable id,
         Object[] currentState, Object[] previousState,
         String[] propertyNames, Type[] types) {
      // TODO Auto-generated method stub
      if (entity instanceof Application) {   
         
         return super.findDirty(entity, id, currentState, previousState,
               propertyNames, types);
      }
      return null;

   }

...


Code:
public void pressOkToUpdate(ActionEvent evt) {
      Application application= service.listAllApplications().get(6); //got application from the base.
      mapProperties(application); //do all the sets of the new values
      update(application, evt); //save

   }


While the update the Interceptor is well called but currentState = previousState in findDirty() function...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 10, 2007 7:56 pm 
Newbie

Joined: Thu Feb 01, 2007 12:57 pm
Posts: 18
Nobody uses this?


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.