Hi,
That is the best I found but again this is only triggered as the flush is happening,
Hibernate does not expose a public API to query managed entity dirtyness at any point in time:
Quote:
public class LoggingInterceptor extends EmptyInterceptor {
private final Logger log = Logger.getLogger(getClass().getSimpleName());
/**
*
*/
private static final long serialVersionUID = -6046643915512943849L;
public LoggingInterceptor() {}
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types) {
log.info("Instance of:" + entity.getClass().getSimpleName() + " is found dirty, currentState:" + Arrays.deepToString(currentState) + ", previousState:" + Arrays.deepToString(previousState));
return false;
}
}