mirror of
https://github.com/google/nomulus
synced 2026-05-28 10:40:44 +00:00
Update Hibernate deps to 7.3.4 (#3040)
The fix for https://hibernate.atlassian.net/browse/HHH-20276 was included in 7.3.4 and will be included in version 8 in the future. 8.x is still in alpha though so we don't want to use it yet.
This commit is contained in:
@@ -145,6 +145,7 @@ public class Domain extends DomainBase implements ForeignKeyedEppResource {
|
||||
// TODO(b/188044616): Determine why Eager loading doesn't work here.
|
||||
Hibernate.initialize(dsData);
|
||||
Hibernate.initialize(gracePeriods);
|
||||
Hibernate.initialize(nsHosts);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -358,13 +358,7 @@ public class DomainBase extends EppResource {
|
||||
return nullToEmptyImmutableCopy(nsHosts);
|
||||
}
|
||||
|
||||
// Hibernate needs this in order to populate nsHosts but no one else should ever use it
|
||||
@SuppressWarnings("unused")
|
||||
private void setNsHosts(Set<VKey<Host>> nsHosts) {
|
||||
this.nsHosts = forceEmptyToNull(nsHosts);
|
||||
}
|
||||
|
||||
// Note: for the two methods below, how we wish to treat the Hibernate setters depends on the
|
||||
// Note: for the three methods below, how we wish to treat the Hibernate setters depends on the
|
||||
// current state of the object and what's passed in. The key principle is that we wish to maintain
|
||||
// the link between parent and child objects, meaning that we should keep around whichever of the
|
||||
// two sets (the parameter vs the class variable and clear/populate that as appropriate).
|
||||
@@ -373,6 +367,20 @@ public class DomainBase extends EppResource {
|
||||
// an exception "A collection with cascade=”all-delete-orphan” was no longer referenced by the
|
||||
// owning entity instance". See https://stackoverflow.com/questions/5587482 for more details.
|
||||
|
||||
// Hibernate needs this in order to populate nsHosts but no one else should ever use it
|
||||
@SuppressWarnings("unused")
|
||||
private void setNsHosts(Set<VKey<Host>> nsHosts) {
|
||||
if (this.nsHosts instanceof PersistentSet) {
|
||||
Set<VKey<Host>> nonNullNsHosts = nullToEmpty(nsHosts);
|
||||
this.nsHosts.retainAll(nonNullNsHosts);
|
||||
this.nsHosts.addAll(nonNullNsHosts);
|
||||
} else if (nsHosts instanceof PersistentSet) {
|
||||
this.nsHosts = nsHosts;
|
||||
} else {
|
||||
this.nsHosts = forceEmptyToNull(nsHosts);
|
||||
}
|
||||
}
|
||||
|
||||
// Hibernate needs this in order to populate gracePeriods but no one else should ever use it
|
||||
@SuppressWarnings("unused")
|
||||
private void setInternalGracePeriods(Set<GracePeriod> gracePeriods) {
|
||||
@@ -642,6 +650,7 @@ public class DomainBase extends EppResource {
|
||||
// cascadable operations and orphan removal.
|
||||
newDomain.gracePeriods =
|
||||
newDomain.gracePeriods == null ? ImmutableSet.of() : newDomain.gracePeriods;
|
||||
newDomain.nsHosts = newDomain.nsHosts == null ? ImmutableSet.of() : newDomain.nsHosts;
|
||||
newDomain.dsData =
|
||||
newDomain.dsData == null
|
||||
? ImmutableSet.of()
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SimplifiedJedisClientTest {
|
||||
// dsData and gracePeriods get serialized as null instead of the empty set, which is fine
|
||||
assertAboutImmutableObjects()
|
||||
.that(client.get(Domain.class, "example.tld").get())
|
||||
.isEqualExceptFields(domain, "dsData", "gracePeriods");
|
||||
.isEqualExceptFields(domain, "dsData", "gracePeriods", "nsHosts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -97,13 +97,13 @@ public class SimplifiedJedisClientTest {
|
||||
|
||||
assertAboutImmutableObjects()
|
||||
.that(client.get(Domain.class, "example1.tld").get())
|
||||
.isEqualExceptFields(domain1, "dsData", "gracePeriods");
|
||||
.isEqualExceptFields(domain1, "dsData", "gracePeriods", "nsHosts");
|
||||
assertAboutImmutableObjects()
|
||||
.that(client.get(Domain.class, "example2.tld").get())
|
||||
.isEqualExceptFields(domain2, "dsData", "gracePeriods");
|
||||
.isEqualExceptFields(domain2, "dsData", "gracePeriods", "nsHosts");
|
||||
assertAboutImmutableObjects()
|
||||
.that(client.get(Domain.class, "example3.tld").get())
|
||||
.isEqualExceptFields(domain3, "dsData", "gracePeriods");
|
||||
.isEqualExceptFields(domain3, "dsData", "gracePeriods", "nsHosts");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ConsoleDomainGetActionTest extends ConsoleActionBaseTestCase {
|
||||
assertThat(response.getPayload())
|
||||
.isEqualTo(
|
||||
"""
|
||||
{"domainName":"exists.tld","registrationExpirationTime":"294247-01-10T04:00:54.775Z",\
|
||||
{"domainName":"exists.tld","nsHosts":[],"registrationExpirationTime":"294247-01-10T04:00:54.775Z",\
|
||||
"repoId":"2-TLD","currentSponsorRegistrarId":"TheRegistrar",\
|
||||
"creationRegistrarId":"TheRegistrar","creationTime":{"creationTime":"1970-01-01T00:00:00.000Z"},\
|
||||
"statuses":["INACTIVE"]}\
|
||||
|
||||
Reference in New Issue
Block a user