@Override
public void mapToMapFromEntity(Map<String, Object> data, Object obj) {
if ( obj == null ) {
data.put( propertyData.getName(), null );
}
else {
if ( obj instanceof HibernateProxy ) {
final HibernateProxy hibernateProxy = (HibernateProxy) obj;
Serializable identifier = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
if ( CLId.class.isInstance(identifier)) {
final Getter getter = ReflectionTools.getGetter( identifier.getClass(), propertyData );
data.put( propertyData.getName(), getter.get( identifier ));
} else {
data.put( propertyData.getName(), identifier );
}
}
else {
final Getter getter = ReflectionTools.getGetter( obj.getClass(), propertyData );
data.put( propertyData.getName(), getter.get( obj ) );
}
}
}