From 32f493e74c58e88635ac486cf69675661b2eae48 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Thu, 27 Jan 2022 11:55:58 +0100 Subject: [PATCH] Fix remaining tests --- .../AgroalTransactionIsolationConfigTest.java | 3 +++ .../c3p0/C3p0TransactionIsolationConfigTest.java | 3 +++ .../query/sql/internal/NativeQueryImpl.java | 2 +- .../jpa/compliance/CriteriaGetParametersTest.java | 4 +++- .../compliance/CriteriaWrongResultClassTest.java | 6 ++++-- .../inline/OptionalOneToOneTest.java | 4 ++-- .../test/procedure/HANAStoredProcedureTest.java | 14 ++++++++------ .../test/procedure/MySQLStoredProcedureTest.java | 2 +- .../test/procedure/OracleStoredProcedureTest.java | 2 +- .../org/hibernate/orm/test/procedure/Person.java | 4 ++-- .../procedure/PostgreSQLStoredProcedureTest.java | 2 +- .../procedure/SQLServerStoredProcedureTest.java | 2 +- .../orm/test/queryhint/QueryHintHANATest.java | 11 ++++++++++- .../hikaricp/HikariCPConnectionProviderTest.java | 3 +++ .../test/hikaricp/HikariCPSkipAutoCommitTest.java | 4 ++++ .../HikariTransactionIsolationConfigTest.java | 5 +++++ .../ProxoolTransactionIsolationConfigTest.java | 3 +++ .../vibur/ViburDBCPConnectionProviderTest.java | 14 +++++++------- 18 files changed, 62 insertions(+), 26 deletions(-) diff --git a/hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalTransactionIsolationConfigTest.java b/hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalTransactionIsolationConfigTest.java index db424e5cda..f62ec27d20 100644 --- a/hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalTransactionIsolationConfigTest.java +++ b/hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalTransactionIsolationConfigTest.java @@ -6,14 +6,17 @@ */ package org.hibernate.test.agroal; +import org.hibernate.dialect.TiDBDialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.agroal.internal.AgroalConnectionProvider; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.common.connections.BaseTransactionIsolationConfigTest; /** * @author Steve Ebersole */ +@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation") public class AgroalTransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest { @Override protected ConnectionProvider getConnectionProviderUnderTest() { diff --git a/hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/C3p0TransactionIsolationConfigTest.java b/hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/C3p0TransactionIsolationConfigTest.java index 1a110eca1b..c5971b691b 100644 --- a/hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/C3p0TransactionIsolationConfigTest.java +++ b/hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/C3p0TransactionIsolationConfigTest.java @@ -9,15 +9,18 @@ package org.hibernate.test.c3p0; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.c3p0.internal.C3P0ConnectionProvider; +import org.hibernate.dialect.TiDBDialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.common.connections.BaseTransactionIsolationConfigTest; import org.junit.Before; /** * @author Steve Ebersole */ +@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation") public class C3p0TransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest { private StandardServiceRegistry ssr; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java b/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java index ca8898db38..633463bdff 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java @@ -272,7 +272,7 @@ public class NativeQueryImpl if ( resultJavaType == Tuple.class ) { setTupleTransformer( new NativeQueryTupleTransformer() ); } - else if ( resultJavaType != null ) { + else if ( resultJavaType != null && resultJavaType != Object[].class ) { switch ( resultSetMapping.getNumberOfResultBuilders() ) { case 0: throw new IllegalArgumentException( "Named query exists but its result type is not compatible" ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaGetParametersTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaGetParametersTest.java index 8db9ad6ad3..a8ba71b6b4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaGetParametersTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaGetParametersTest.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test; import jakarta.persistence.Entity; import jakarta.persistence.Id; +import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; import jakarta.persistence.Table; import jakarta.persistence.TypedQuery; @@ -118,6 +119,7 @@ public class CriteriaGetParametersTest { private Integer age; @ManyToMany + @JoinTable(name = "PERSON_ADDRESSES_TABLE") private Collection
addresses; Person() { @@ -143,7 +145,7 @@ public class CriteriaGetParametersTest { } } - @Entity + @Entity(name = "Address") public static class Address { @Id private Integer id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaWrongResultClassTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaWrongResultClassTest.java index 3ce56e1f77..384404ad3c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaWrongResultClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/CriteriaWrongResultClassTest.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Test; import jakarta.persistence.Entity; import jakarta.persistence.Id; +import jakarta.persistence.JoinTable; import jakarta.persistence.MapKey; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; @@ -50,7 +51,7 @@ public class CriteriaWrongResultClassTest { ); } - @Entity + @Entity(name = "Department") @Table(name = "DEPARTMENT_TABLE") public static class Department { @Id @@ -59,6 +60,7 @@ public class CriteriaWrongResultClassTest { private String name; @OneToMany + @JoinTable(name = "DEPARTMENT_EMPLOYEE_TABLE") @MapKey(name = "nickname") private Map people = new HashMap<>(); @@ -89,7 +91,7 @@ public class CriteriaWrongResultClassTest { } } - @Entity + @Entity(name = "Person") @Table(name = "EMPLOYEE_TABLE") public static class Person { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/valuehandlingmode/inline/OptionalOneToOneTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/valuehandlingmode/inline/OptionalOneToOneTest.java index a070be968b..983c00209e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/valuehandlingmode/inline/OptionalOneToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/valuehandlingmode/inline/OptionalOneToOneTest.java @@ -57,7 +57,7 @@ public class OptionalOneToOneTest { } ); } - @Entity + @Entity(name = "Person") public static class Person { @Id @GeneratedValue(generator = "fk") @GenericGenerator(strategy = "foreign", name = "fk", parameters = @Parameter(name="property", value="personAddress")) @@ -85,7 +85,7 @@ public class OptionalOneToOneTest { } - @Entity + @Entity(name = "PersonAddress") public static class PersonAddress { @Id @GeneratedValue diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/HANAStoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/HANAStoredProcedureTest.java index 7b49b311ec..c0f411fb36 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/HANAStoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/HANAStoredProcedureTest.java @@ -33,10 +33,11 @@ import org.hibernate.type.YesNoConverter; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.RequiresDialect; +import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; -import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -54,6 +55,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; Vote.class } ) +@SessionFactory public class HANAStoredProcedureTest { @NamedStoredProcedureQueries({ @@ -72,7 +74,7 @@ public class HANAStoredProcedureTest { String name; } - @BeforeAll + @BeforeEach public void prepareSchemaAndData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.doWork( connection -> { @@ -181,7 +183,7 @@ public class HANAStoredProcedureTest { } ); scope.inTransaction( (session) -> { - Person person1 = new Person( "John Doe" ); + Person person1 = new Person( 1L, "John Doe" ); person1.setNickName( "JD" ); person1.setAddress( "Earth" ); person1.setCreatedOn( Timestamp.from( LocalDateTime.of( 2000, 1, 1, 0, 0, 0 ).toInstant( ZoneOffset.UTC ) ) ); @@ -202,7 +204,7 @@ public class HANAStoredProcedureTest { } ); } - @AfterAll + @AfterEach public void cleanUpSchemaAndData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.createMutationQuery( "delete Phone" ).executeUpdate(); @@ -313,7 +315,7 @@ public class HANAStoredProcedureTest { try ( ResultSet resultSet = function.getResultSet() ) { while ( resultSet.next() ) { assertThat( resultSet.getLong( 1 ) ).isInstanceOf( Long.class ); - assertThat( resultSet.getLong( 2 ) ).isInstanceOf( String.class ); + assertThat( resultSet.getString( 2 ) ).isInstanceOf( String.class ); } } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/MySQLStoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/MySQLStoredProcedureTest.java index ceae5c25f1..1b8a98439b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/MySQLStoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/MySQLStoredProcedureTest.java @@ -124,7 +124,7 @@ public class MySQLStoredProcedureTest { scope.inTransaction( em -> { - Person person1 = new Person( "John Doe" ); + Person person1 = new Person( 1L, "John Doe" ); person1.setNickName( "JD" ); person1.setAddress( "Earth" ); person1.setCreatedOn( Timestamp.from( LocalDateTime.of( 2000, 1, 1, 0, 0, 0 ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java index 211148aacb..219401090c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java @@ -430,7 +430,7 @@ public class OracleStoredProcedureTest { } ) ); scope.inTransaction( (entityManager) -> { - person1 = new Person( "John Doe" ); + person1 = new Person( 1L, "John Doe" ); person1.setNickName( "JD" ); person1.setAddress( "Earth" ); person1.setCreatedOn( Timestamp.from( LocalDateTime.of( 2000, 1, 1, 0, 0, 0 ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/Person.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/Person.java index 3fdefb3f17..14dc6433ce 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/Person.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/Person.java @@ -103,7 +103,6 @@ import static org.hibernate.jpa.HibernateHints.HINT_CALLABLE_FUNCTION; public class Person { @Id - @GeneratedValue private Long id; private String name; @@ -128,7 +127,8 @@ public class Person { public Person() {} - public Person(String name) { + public Person(Long id, String name) { + this.id = id; this.name = name; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLStoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLStoredProcedureTest.java index 234bf5af98..3aeb5484b4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLStoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLStoredProcedureTest.java @@ -202,7 +202,7 @@ public class PostgreSQLStoredProcedureTest extends BaseEntityManagerFunctionalTe } ); doInJPA( this::entityManagerFactory, entityManager -> { - Person person1 = new Person( "John Doe" ); + Person person1 = new Person( 1L, "John Doe" ); person1.setNickName( "JD" ); person1.setAddress( "Earth" ); person1.setCreatedOn( Timestamp.from( LocalDateTime.of( 2000, 1, 1, 0, 0, 0 ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/SQLServerStoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/SQLServerStoredProcedureTest.java index d7f1ad2bb8..52dad950c1 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/SQLServerStoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/SQLServerStoredProcedureTest.java @@ -83,7 +83,7 @@ public class SQLServerStoredProcedureTest { ); scope.inTransaction( entityManager -> { - Person person1 = new Person( "John Doe" ); + Person person1 = new Person( 1L, "John Doe" ); person1.setNickName( "JD" ); person1.setAddress( "Earth" ); person1.setCreatedOn( Timestamp.from( LocalDateTime.of( 2000, 1, 1, 0, 0, 0 ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/queryhint/QueryHintHANATest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/queryhint/QueryHintHANATest.java index d0b96e5ad7..f09b7faa08 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/queryhint/QueryHintHANATest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/queryhint/QueryHintHANATest.java @@ -29,6 +29,7 @@ import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.Setting; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -49,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SessionFactory( useCollectingStatementInspector = true ) @RequiresDialect(AbstractHANADialect.class) // afaik this does not work -@NotImplementedYet( strict = false ) +//@NotImplementedYet( strict = false ) public class QueryHintHANATest { @BeforeEach @@ -67,6 +68,14 @@ public class QueryHintHANATest { } ); } + @AfterEach + public void cleanupTestData(SessionFactoryScope scope) { + scope.inTransaction( (s) -> { + s.createMutationQuery( "delete from QueryHintHANATest$Employee" ).executeUpdate(); + s.createMutationQuery( "delete from QueryHintHANATest$Department" ).executeUpdate(); + } ); + } + @Test public void testQueryHint(SessionFactoryScope scope) { scope.getCollectingStatementInspector().clear(); diff --git a/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPConnectionProviderTest.java b/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPConnectionProviderTest.java index de38961c20..37e52d32f2 100644 --- a/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPConnectionProviderTest.java +++ b/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPConnectionProviderTest.java @@ -11,10 +11,12 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import org.hibernate.dialect.SybaseDialect; import org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.ConnectionProviderJdbcConnectionAccess; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.hikaricp.internal.HikariCPConnectionProvider; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; @@ -27,6 +29,7 @@ import static org.junit.Assert.fail; /** * @author Brett Meyer */ +@SkipForDialect(value = SybaseDialect.class, comment = "The jTDS driver doesn't implement Connection#isValid so this fails") public class HikariCPConnectionProviderTest extends BaseCoreFunctionalTestCase { @Test diff --git a/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPSkipAutoCommitTest.java b/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPSkipAutoCommitTest.java index 496864e564..7a4c58236d 100644 --- a/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPSkipAutoCommitTest.java +++ b/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariCPSkipAutoCommitTest.java @@ -17,7 +17,10 @@ import org.hibernate.cfg.Configuration; import org.hibernate.testing.DialectChecks; import org.hibernate.testing.RequiresDialectFeature; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; + +import org.hibernate.dialect.SybaseDialect; import org.hibernate.orm.test.util.PreparedStatementSpyConnectionProvider; import org.junit.Test; @@ -32,6 +35,7 @@ import static org.mockito.Mockito.verify; * @author Vlad Mihalcea */ @RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class) +@SkipForDialect(value = SybaseDialect.class, comment = "The jTDS driver doesn't implement Connection#isValid so this fails") public class HikariCPSkipAutoCommitTest extends BaseCoreFunctionalTestCase { private PreparedStatementSpyConnectionProvider connectionProvider = diff --git a/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariTransactionIsolationConfigTest.java b/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariTransactionIsolationConfigTest.java index 6893f9f907..82f39e47cc 100644 --- a/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariTransactionIsolationConfigTest.java +++ b/hibernate-hikaricp/src/test/java/org/hibernate/test/hikaricp/HikariTransactionIsolationConfigTest.java @@ -6,14 +6,19 @@ */ package org.hibernate.test.hikaricp; +import org.hibernate.dialect.SybaseDialect; +import org.hibernate.dialect.TiDBDialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.hikaricp.internal.HikariCPConnectionProvider; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.common.connections.BaseTransactionIsolationConfigTest; /** * @author Steve Ebersole */ +@SkipForDialect(value = SybaseDialect.class, comment = "The jTDS driver doesn't implement Connection#getNetworkTimeout() so this fails") +@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation") public class HikariTransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest { @Override protected ConnectionProvider getConnectionProviderUnderTest() { diff --git a/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java b/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java index 6072cac095..b439bbc963 100644 --- a/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java +++ b/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java @@ -13,16 +13,19 @@ import java.util.Properties; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.AvailableSettings; +import org.hibernate.dialect.TiDBDialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.proxool.internal.ProxoolConnectionProvider; import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.common.connections.BaseTransactionIsolationConfigTest; import org.junit.Before; /** * @author Steve Ebersole */ +@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation") public class ProxoolTransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest { private Map properties; private StandardServiceRegistry ssr; diff --git a/hibernate-vibur/src/test/java/org/hibernate/test/vibur/ViburDBCPConnectionProviderTest.java b/hibernate-vibur/src/test/java/org/hibernate/test/vibur/ViburDBCPConnectionProviderTest.java index 3766b83d2c..5674709d47 100644 --- a/hibernate-vibur/src/test/java/org/hibernate/test/vibur/ViburDBCPConnectionProviderTest.java +++ b/hibernate-vibur/src/test/java/org/hibernate/test/vibur/ViburDBCPConnectionProviderTest.java @@ -73,16 +73,17 @@ public class ViburDBCPConnectionProviderTest extends BaseCoreFunctionalTestCase buildSessionFactory(); doInHibernate(this::sessionFactory, session -> { - addDbRecord(session, "CHRISTIAN", "GABLE"); - addDbRecord(session, "CHRISTIAN", "AKROYD"); - addDbRecord(session, "CHRISTIAN", "NEESON"); - addDbRecord(session, "CAMERON", "NEESON"); - addDbRecord(session, "RAY", "JOHANSSON"); + addDbRecord(session, 1L, "CHRISTIAN", "GABLE"); + addDbRecord(session, 2L, "CHRISTIAN", "AKROYD"); + addDbRecord(session, 3L, "CHRISTIAN", "NEESON"); + addDbRecord(session, 4L, "CAMERON", "NEESON"); + addDbRecord(session, 5L, "RAY", "JOHANSSON"); }); } - private static void addDbRecord(Session session, String firstName, String lastName) { + private static void addDbRecord(Session session, Long id, String firstName, String lastName) { Actor actor = new Actor(); + actor.setId( id ); actor.setFirstName(firstName); actor.setLastName(lastName); session.persist(actor); @@ -145,7 +146,6 @@ public class ViburDBCPConnectionProviderTest extends BaseCoreFunctionalTestCase @Entity(name="Actor") public static class Actor { @Id - @GeneratedValue private Long id; private String firstName;