HHH-18830 fix tests

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-11-09 21:05:51 +01:00
parent 9e5bd35cbb
commit afa373f7c3
7 changed files with 26 additions and 8 deletions

View File

@ -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;
}
}
}

View File

@ -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();

View File

@ -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 );

View File

@ -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 {

View File

@ -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<Object,Object> 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;
}
}

View File

@ -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> extensions = new ArrayList<>();
}

View File

@ -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> extensions = new ArrayList<>();
}