mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
HHH-13760 Code formatting changes & suggested logic simplification
This commit is contained in:
parent
d1b32d2b65
commit
b3ea1d67c4
@ -54,23 +54,15 @@ public boolean mapToMapFromEntity(
|
||||
Object oldObj) {
|
||||
final HashMap<String, Object> newData = new HashMap<>();
|
||||
|
||||
Object oldObject = oldObj;
|
||||
Object newObject = newObj;
|
||||
if ( lazyMapping ) {
|
||||
if ( nonInsertableFake && oldObject instanceof HibernateProxy ) {
|
||||
oldObject = ( (HibernateProxy) oldObject ).getHibernateLazyInitializer().getImplementation();
|
||||
}
|
||||
|
||||
|
||||
if ( !nonInsertableFake && newObject instanceof HibernateProxy ) {
|
||||
newObject = ( (HibernateProxy) newObject ).getHibernateLazyInitializer().getImplementation();
|
||||
}
|
||||
}
|
||||
|
||||
// If this property is originally non-insertable, but made insertable because it is in a many-to-one "fake"
|
||||
// bi-directional relation, we always store the "old", unchaged data, to prevent storing changes made
|
||||
// bi-directional relation, we always store the "old", unchanged data, to prevent storing changes made
|
||||
// to this field. It is the responsibility of the collection to properly update it if it really changed.
|
||||
delegate.mapToMapFromEntity( newData, nonInsertableFake ? oldObject : newObject );
|
||||
Object entity = nonInsertableFake ? oldObj : newObj;
|
||||
if ( lazyMapping && entity instanceof HibernateProxy ) {
|
||||
entity = ( (HibernateProxy) entity ).getHibernateLazyInitializer().getImplementation();
|
||||
}
|
||||
|
||||
delegate.mapToMapFromEntity( newData, entity );
|
||||
|
||||
for ( Map.Entry<String, Object> entry : newData.entrySet() ) {
|
||||
data.put( entry.getKey(), entry.getValue() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user