private boolean copyState(Object entity, Type[] types, Object[] state, SessionFactory sf) { // copy the entity state into the state array and return true if the state has changed ClassMetadata metadata = sf.getClassMetadata( entity.getClass() ); Object[] newState = metadata.getPropertyValues( entity ); int size = newState.length; boolean isDirty = false; for ( int index = 0; index < size; index++ ) { if ( ( state[index] == LazyPropertyInitializer.UNFETCHED_PROPERTY && newState[index] != LazyPropertyInitializer.UNFETCHED_PROPERTY ) || ( state[index] != newState[index] && !types[index].isEqual( state[index], newState[index] ) ) ) { isDirty = true; state[index] = newState[index]; } } return isDirty; }
@Override public Object[] getPropertyValues(final Object entity) throws HibernateException { return PropertyValueAdapter.adaptToV2(metadata.getPropertyValues(entity)); }
private boolean copyState(Object entity, Type[] types, Object[] state, SessionFactory sf) { // copy the entity state into the state array and return true if the state has changed ClassMetadata metadata = sf.getClassMetadata( entity.getClass() ); Object[] newState = metadata.getPropertyValues( entity ); int size = newState.length; boolean isDirty = false; for ( int index = 0; index < size ; index++ ) { if ( !types[index].isEqual( state[index], newState[index] ) ) { isDirty = true; state[index] = newState[index]; } } return isDirty; } }
/** * 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; state[index] = newState[index]; } } return isDirty; } }
/** * 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; state[index] = newState[index]; } } return isDirty; } }
/** * @param entity an actual entity object, not a proxy! */ public String toString(Object entity, EntityMode entityMode) throws HibernateException { // todo : this call will not work for anything other than pojos! ClassMetadata cm = factory.getClassMetadata( entity.getClass() ); if ( cm==null ) return entity.getClass().getName(); Map result = new HashMap(); if ( cm.hasIdentifierProperty() ) { result.put( cm.getIdentifierPropertyName(), cm.getIdentifierType().toLoggableString( cm.getIdentifier( entity, entityMode ), factory ) ); } Type[] types = cm.getPropertyTypes(); String[] names = cm.getPropertyNames(); Object[] values = cm.getPropertyValues( entity, entityMode ); for ( int i=0; i<types.length; i++ ) { if ( !names[i].startsWith("_") ) { String strValue = values[i]==LazyPropertyInitializer.UNFETCHED_PROPERTY ? values[i].toString() : types[i].toLoggableString( values[i], factory ); result.put( names[i], strValue ); } } return cm.getEntityName() + result.toString(); }
/** * @param entity an actual entity object, not a proxy! */ public String toString(Object entity, EntityMode entityMode) throws HibernateException { // todo : this call will not work for anything other than pojos! ClassMetadata cm = factory.getClassMetadata( entity.getClass() ); if ( cm==null ) return entity.getClass().getName(); Map result = new HashMap(); if ( cm.hasIdentifierProperty() ) { result.put( cm.getIdentifierPropertyName(), cm.getIdentifierType().toLoggableString( cm.getIdentifier( entity, entityMode ), factory ) ); } Type[] types = cm.getPropertyTypes(); String[] names = cm.getPropertyNames(); Object[] values = cm.getPropertyValues( entity, entityMode ); for ( int i=0; i<types.length; i++ ) { if ( !names[i].startsWith("_") ) { String strValue = values[i]==LazyPropertyInitializer.UNFETCHED_PROPERTY ? values[i].toString() : types[i].toLoggableString( values[i], factory ); result.put( names[i], strValue ); } } return cm.getEntityName() + result.toString(); }
public IObject[] getLockCandidates(IObject o) { int idx = 0; IObject[] toCheck = new IObject[total()]; Object[] values = cm.getPropertyValues(o, EntityMode.POJO); for (int i = 0; i < size(); i++) { if (!include(i)) {