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...