HHH-14329 Amend existing DirtyTrackingTest
This commit is contained in:
parent
e891a0296c
commit
6b55f8ea09
|
@ -63,11 +63,20 @@ public class DirtyTrackingTest {
|
||||||
EnhancerTestUtils.checkDirtyTracking( entity, "someStrings" );
|
EnhancerTestUtils.checkDirtyTracking( entity, "someStrings" );
|
||||||
EnhancerTestUtils.clearDirtyTracking( entity );
|
EnhancerTestUtils.clearDirtyTracking( entity );
|
||||||
|
|
||||||
// Association: this should not set the entity to dirty
|
// Association, 1: creating the association will mark it dirty
|
||||||
Set<Integer> intSet = new HashSet<>();
|
Set<OtherEntity> associatedSet = new HashSet<>();
|
||||||
intSet.add( 42 );
|
OtherEntity o = new OtherEntity();
|
||||||
entity.someInts = intSet;
|
o.id = 1l;
|
||||||
|
o.name = "other";
|
||||||
|
associatedSet.add( o );
|
||||||
|
entity.someAssociation = associatedSet;
|
||||||
|
EnhancerTestUtils.checkDirtyTracking( entity, "someAssociation" );
|
||||||
|
EnhancerTestUtils.clearDirtyTracking( entity );
|
||||||
|
|
||||||
|
// Association, 2: modifying a related entity should not
|
||||||
|
o.name = "newName";
|
||||||
EnhancerTestUtils.checkDirtyTracking( entity );
|
EnhancerTestUtils.checkDirtyTracking( entity );
|
||||||
|
EnhancerTestUtils.checkDirtyTracking( o, "name" );
|
||||||
|
|
||||||
// testing composite object
|
// testing composite object
|
||||||
Address address = new Address();
|
Address address = new Address();
|
||||||
|
@ -125,7 +134,7 @@ public class DirtyTrackingTest {
|
||||||
List<String> someStrings;
|
List<String> someStrings;
|
||||||
|
|
||||||
@OneToMany
|
@OneToMany
|
||||||
Set<Integer> someInts;
|
Set<OtherEntity> someAssociation;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
Address address;
|
Address address;
|
||||||
|
@ -141,4 +150,11 @@ public class DirtyTrackingTest {
|
||||||
this.someNumber = someNumber;
|
this.someNumber = someNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
private static class OtherEntity {
|
||||||
|
@Id
|
||||||
|
Long id;
|
||||||
|
String name;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue