Fix remaining tests
This commit is contained in:
parent
31bc14979b
commit
32f493e74c
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ public class NativeQueryImpl<R>
|
|||
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" );
|
||||
|
|
|
@ -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<Address> addresses;
|
||||
|
||||
Person() {
|
||||
|
@ -143,7 +145,7 @@ public class CriteriaGetParametersTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Address")
|
||||
public static class Address {
|
||||
@Id
|
||||
private Integer id;
|
||||
|
|
|
@ -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<String, Person> people = new HashMap<>();
|
||||
|
||||
|
@ -89,7 +91,7 @@ public class CriteriaWrongResultClassTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Person")
|
||||
@Table(name = "EMPLOYEE_TABLE")
|
||||
public static class Person {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<String,Object> properties;
|
||||
private StandardServiceRegistry ssr;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue