HHH-10554 - Fix NPE in dirty tracking generated code of bytecode enhanced @Embeddable entities

This commit is contained in:
barreiro 2016-02-23 00:03:55 +00:00 committed by Steve Ebersole
parent a69b485d1b
commit c5104601e1
2 changed files with 4 additions and 1 deletions

View File

@ -448,7 +448,7 @@ public class PersistentAttributesEnhancer extends Enhancer {
// trigger track changes // trigger track changes
fieldWriter.insertAfter( fieldWriter.insertAfter(
String.format( String.format(
"((%2$s) %1$s).%4$s(\"%1$s\", (%3$s) this);%n" + "if (%1$s != null) { ((%2$s) %1$s).%4$s(\"%1$s\", (%3$s) this); }%n" +
"%5$s(\"%1$s\");", "%5$s(\"%1$s\");",
persistentField.getName(), persistentField.getName(),
CompositeTracker.class.getName(), CompositeTracker.class.getName(),

View File

@ -84,6 +84,9 @@ public class DirtyTrackingTestTask extends AbstractEnhancerTestTask {
country.setName( "Norway" ); country.setName( "Norway" );
EnhancerTestUtils.checkDirtyTracking( entity, "address", "address.country" ); EnhancerTestUtils.checkDirtyTracking( entity, "address", "address.country" );
address.setCountry( null );
entity.setAddress( null );
} }
protected void cleanup() { protected void cleanup() {