From afa373f7c32d6240985bee9cb82450e105a29e2d Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 9 Nov 2024 21:05:51 +0100 Subject: [PATCH] HHH-18830 fix tests Signed-off-by: Gavin King --- .../test/cfg/persister/GoofyPersisterClassProvider.java | 7 +++++++ .../java/org/hibernate/orm/test/cid/CompositeIdTest.java | 4 +--- .../mapkeycolumn/MapKeyColumnBiDiOneToManyFKTest.java | 1 + .../jpa/ejb3configuration/PersisterClassProviderTest.java | 5 +++++ .../org/hibernate/orm/test/legacy/CustomPersister.java | 7 ++++++- .../mappedBy/MappedByCompositeNonAssociationTest.java | 5 +++-- .../test/mapping/mappedBy/MappedByNonAssociationTest.java | 5 +++-- 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java index d61f830c6c..bc2fe852e5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java @@ -108,6 +108,11 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { throw new GoofyException(NoopEntityPersister.class); } + @Override + public boolean managesColumns(String[] columnNames) { + return false; + } + @Override public NavigableRole getNavigableRole() { return null; @@ -1331,5 +1336,7 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { public EntityPersister getElementPersister() { return null; } + + } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cid/CompositeIdTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cid/CompositeIdTest.java index c69559a913..034d3de087 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cid/CompositeIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cid/CompositeIdTest.java @@ -159,10 +159,8 @@ public class CompositeIdTest { statementInspector.clear(); session.flush(); - statementInspector.assertExecutedCount( 3 ); + statementInspector.assertExecutedCount( 1 ); statementInspector.assertIsInsert( 0 ); - statementInspector.assertIsUpdate( 1 ); - statementInspector.assertIsUpdate( 2 ); statementInspector.clear(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/mapkeycolumn/MapKeyColumnBiDiOneToManyFKTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/mapkeycolumn/MapKeyColumnBiDiOneToManyFKTest.java index f33a8d8078..e80b080101 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/mapkeycolumn/MapKeyColumnBiDiOneToManyFKTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/mapkeycolumn/MapKeyColumnBiDiOneToManyFKTest.java @@ -47,6 +47,7 @@ public class MapKeyColumnBiDiOneToManyFKTest extends BaseNonConfigCoreFunctional Address2 address = session.get( Address2.class, 1 ); address.holder = holder; + address.type = "work"; holder.addresses.put( "work", address ); session.persist( holder ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java index f57a7f2dde..744917ba6a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java @@ -1074,6 +1074,11 @@ public class PersisterClassProviderTest { public String getAttributeMutationTableName(int i) { return ""; } + + @Override + public boolean managesColumns(String[] columnNames) { + return false; + } } public static class GoofyException extends RuntimeException { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java index f783dca8c1..a73374d499 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java @@ -83,7 +83,7 @@ import org.hibernate.type.internal.BasicTypeImpl; import org.checkerframework.checker.nullness.qual.Nullable; -public class CustomPersister implements EntityPersister { +public class CustomPersister implements EntityPersister { private static final Hashtable INSTANCES = new Hashtable<>(); private static final IdentifierGenerator GENERATOR = new UUIDHexGenerator(); @@ -1181,4 +1181,9 @@ public class CustomPersister implements EntityPersister { public String getAttributeMutationTableName(int i) { return ""; } + + @Override + public boolean managesColumns(String[] columnNames) { + return false; + } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByCompositeNonAssociationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByCompositeNonAssociationTest.java index 360d2102b3..c83516f462 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByCompositeNonAssociationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByCompositeNonAssociationTest.java @@ -12,6 +12,7 @@ import jakarta.persistence.Id; import jakarta.persistence.OneToMany; import jakarta.persistence.OrderColumn; import org.hibernate.Hibernate; +import org.hibernate.annotations.ListIndexBase; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; @@ -30,7 +31,7 @@ public class MappedByCompositeNonAssociationTest { @Test void test(SessionFactoryScope scope) { Extensions ex = new Extensions(); ex.exExtensionDays = 3L; - ex.extensionId.exNo = 2L; + ex.extensionId.exNo = 1L; ex.extensionId.exLoanId = 4L; Loan loan = new Loan(); @@ -59,7 +60,7 @@ public class MappedByCompositeNonAssociationTest { private Long id; @OneToMany(cascade = PERSIST, mappedBy = "extensionId.exLoanId") - @OrderColumn(name = "EX_NO") + @OrderColumn(name = "EX_NO") @ListIndexBase(1) private List extensions = new ArrayList<>(); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByNonAssociationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByNonAssociationTest.java index 6344d212b8..c34133b556 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByNonAssociationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/MappedByNonAssociationTest.java @@ -10,6 +10,7 @@ import jakarta.persistence.Id; import jakarta.persistence.OneToMany; import jakarta.persistence.OrderColumn; import org.hibernate.Hibernate; +import org.hibernate.annotations.ListIndexBase; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; @@ -28,7 +29,7 @@ public class MappedByNonAssociationTest { @Test void test(SessionFactoryScope scope) { Extensions ex = new Extensions(); ex.exExtensionDays = 3L; - ex.exNo = 2L; + ex.exNo = 1L; ex.exLoanId = 4L; Loan loan = new Loan(); @@ -57,7 +58,7 @@ public class MappedByNonAssociationTest { private Long id; @OneToMany(cascade = PERSIST, mappedBy = "exLoanId") - @OrderColumn(name = "EX_NO") + @OrderColumn(name = "EX_NO") @ListIndexBase(1) private List extensions = new ArrayList<>(); }