/**
* copy the entity state into the state array and return true if the state has changed
*/
private boolean copyState(Object entity, Type[] types, Object[] state, SessionFactory sf) {
ClassMetadata metadata = sf.getClassMetadata( entity.getClass() );
Object[] newState = metadata.getPropertyValues( entity, EntityMode.POJO );
int size = newState.length;
boolean isDirty = false;
for ( int index = 0; index < size ; index++ ) {
if ( !types[index].isEqual( state[index], newState[index], EntityMode.POJO ) ) {
isDirty = true;