@@ -355,9 +355,7 @@ public boolean isModified(
355355 @ Override
356356 public void nullSafeSet (PreparedStatement st , Object value , int begin , SharedSessionContractImplementor session )
357357 throws HibernateException , SQLException {
358-
359- Object [] subvalues = nullSafeGetValues ( value );
360-
358+ final Object [] subvalues = nullSafeGetValues ( value );
361359 for ( int i = 0 ; i < propertySpan ; i ++ ) {
362360 propertyTypes [i ].nullSafeSet ( st , subvalues [i ], begin , session );
363361 begin += propertyTypes [i ].getColumnSpan ( session .getFactory ().getRuntimeMetamodels () );
@@ -372,7 +370,6 @@ public void nullSafeSet(
372370 boolean [] settable ,
373371 SharedSessionContractImplementor session )
374372 throws HibernateException , SQLException {
375-
376373 final Object [] subvalues = nullSafeGetValues ( value );
377374 int loc = 0 ;
378375 for ( int i = 0 ; i < propertySpan ; i ++ ) {
@@ -481,18 +478,19 @@ public String toLoggableString(Object value, SessionFactoryImplementor factory)
481478 if ( value == null ) {
482479 return "null" ;
483480 }
484-
485- final Map <String , String > result = new HashMap <>();
486- final Object [] values = getPropertyValues ( value );
487- for ( int i = 0 ; i < propertyTypes .length ; i ++ ) {
488- if ( values [i ] == LazyPropertyInitializer .UNFETCHED_PROPERTY ) {
489- result .put ( propertyNames [i ], "<uninitialized>" );
490- }
491- else {
492- result .put ( propertyNames [i ], propertyTypes [i ].toLoggableString ( values [i ], factory ) );
481+ else {
482+ final Map <String , String > result = new HashMap <>();
483+ final Object [] values = getPropertyValues ( value );
484+ for ( int i = 0 ; i < propertyTypes .length ; i ++ ) {
485+ if ( values [i ] == LazyPropertyInitializer .UNFETCHED_PROPERTY ) {
486+ result .put ( propertyNames [i ], "<uninitialized>" );
487+ }
488+ else {
489+ result .put ( propertyNames [i ], propertyTypes [i ].toLoggableString ( values [i ], factory ) );
490+ }
493491 }
492+ return unqualify ( getName () ) + result ;
494493 }
495- return unqualify ( getName () ) + result ;
496494 }
497495
498496 @ Override
@@ -505,22 +503,23 @@ public Object deepCopy(Object component, SessionFactoryImplementor factory) {
505503 if ( component == null ) {
506504 return null ;
507505 }
506+ else {
507+ final Object [] values = getPropertyValues ( component );
508+ for ( int i = 0 ; i < propertySpan ; i ++ ) {
509+ values [i ] = propertyTypes [i ].deepCopy ( values [i ], factory );
510+ }
508511
509- final Object [] values = getPropertyValues ( component );
510- for ( int i = 0 ; i < propertySpan ; i ++ ) {
511- values [i ] = propertyTypes [i ].deepCopy ( values [i ], factory );
512- }
512+ final Object result = instantiator ( component ).instantiate ( () -> values );
513513
514- final Object result = instantiator ( component ).instantiate ( () -> values );
514+ //not absolutely necessary, but helps for some
515+ //equals()/hashCode() implementations
516+ final PropertyAccess parentAccess = mappingModelPart ().getParentInjectionAttributePropertyAccess ();
517+ if ( parentAccess != null ) {
518+ parentAccess .getSetter ().set ( result , parentAccess .getGetter ().get ( component ) );
519+ }
515520
516- //not absolutely necessary, but helps for some
517- //equals()/hashCode() implementations
518- final PropertyAccess parentAccess = mappingModelPart ().getParentInjectionAttributePropertyAccess ();
519- if ( parentAccess != null ) {
520- parentAccess .getSetter ().set ( result , parentAccess .getGetter ().get ( component ) );
521+ return result ;
521522 }
522-
523- return result ;
524523 }
525524
526525 @ Override
@@ -530,28 +529,28 @@ public Object replace(
530529 SharedSessionContractImplementor session ,
531530 Object owner ,
532531 Map <Object , Object > copyCache ) {
533-
534532 if ( original == null ) {
535533 return null ;
536534 }
537-
538- final Object [] originalValues = getPropertyValues ( original );
539- final Object [] resultValues = getPropertyValues ( target );
540- final Object [] replacedValues = TypeHelper .replace (
541- originalValues ,
542- resultValues ,
543- propertyTypes ,
544- session ,
545- owner ,
546- copyCache
547- );
548-
549- if ( target == null || !isMutable () ) {
550- return instantiator ( original ).instantiate ( () -> replacedValues );
551- }
552535 else {
553- setPropertyValues ( target , replacedValues );
554- return target ;
536+ final Object [] originalValues = getPropertyValues ( original );
537+ final Object [] resultValues = getPropertyValues ( target );
538+ final Object [] replacedValues = TypeHelper .replace (
539+ originalValues ,
540+ resultValues ,
541+ propertyTypes ,
542+ session ,
543+ owner ,
544+ copyCache
545+ );
546+
547+ if ( target == null || !isMutable () ) {
548+ return instantiator ( original ).instantiate ( () -> replacedValues );
549+ }
550+ else {
551+ setPropertyValues ( target , replacedValues );
552+ return target ;
553+ }
555554 }
556555 }
557556
@@ -563,28 +562,29 @@ public Object replace(
563562 Object owner ,
564563 Map <Object , Object > copyCache ,
565564 ForeignKeyDirection foreignKeyDirection ) {
566-
567565 if ( original == null ) {
568566 return null ;
569567 }
570- final Object [] originalValues = getPropertyValues ( original );
571- final Object [] resultValues = getPropertyValues ( target );
572- final Object [] replacedValues = TypeHelper .replace (
573- originalValues ,
574- resultValues ,
575- propertyTypes ,
576- session ,
577- owner ,
578- copyCache ,
579- foreignKeyDirection
580- );
581-
582- if ( target == null || !isMutable () ) {
583- return instantiator ( original ).instantiate ( () -> replacedValues );
584- }
585568 else {
586- setPropertyValues ( target , replacedValues );
587- return target ;
569+ final Object [] originalValues = getPropertyValues ( original );
570+ final Object [] resultValues = getPropertyValues ( target );
571+ final Object [] replacedValues = TypeHelper .replace (
572+ originalValues ,
573+ resultValues ,
574+ propertyTypes ,
575+ session ,
576+ owner ,
577+ copyCache ,
578+ foreignKeyDirection
579+ );
580+
581+ if ( target == null || !isMutable () ) {
582+ return instantiator ( original ).instantiate ( () -> replacedValues );
583+ }
584+ else {
585+ setPropertyValues ( target , replacedValues );
586+ return target ;
587+ }
588588 }
589589 }
590590
0 commit comments