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

(cherry picked from commit c5104601e1)
This commit is contained in:
barreiro 2016-02-23 00:03:55 +00:00 committed by Steve Ebersole
parent ae25390006
commit 6a4128653a
2 changed files with 4 additions and 1 deletions

View File

@ -448,7 +448,7 @@ public class PersistentAttributesEnhancer extends Enhancer {
// trigger track changes
fieldWriter.insertAfter(
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\");",
persistentField.getName(),
CompositeTracker.class.getName(),

View File

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