HHH-10554 - Fix NPE in dirty tracking generated code of bytecode enhanced @Embeddable entities
(cherry picked from commit c5104601e1
)
This commit is contained in:
parent
ae25390006
commit
6a4128653a
|
@ -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(),
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue