HHH-10689 - Fix tests failing when switching to Oracle
This commit is contained in:
parent
eb2bf6e2e7
commit
231484662b
|
@ -11,6 +11,7 @@
|
|||
/build
|
||||
*/build
|
||||
testdb
|
||||
lib
|
||||
|
||||
# IntelliJ specific files/directories
|
||||
out
|
||||
|
|
12
build.gradle
12
build.gradle
|
@ -149,6 +149,18 @@ subprojects { subProject ->
|
|||
testRuntime( libraries.mariadb )
|
||||
testRuntime( libraries.woodstox )
|
||||
|
||||
if (db.equalsIgnoreCase("oracle")) {
|
||||
dependencies {
|
||||
testRuntime( libraries.oracle )
|
||||
}
|
||||
}
|
||||
|
||||
if (db.equalsIgnoreCase("mssql")) {
|
||||
dependencies {
|
||||
testRuntime( libraries.mssql )
|
||||
}
|
||||
}
|
||||
|
||||
// 6.6 gave me some NPE problems from within checkstyle...
|
||||
checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
|
||||
}
|
||||
|
|
|
@ -73,6 +73,19 @@ dependencies {
|
|||
testRuntime( libraries.hsqldb )
|
||||
testRuntime( libraries.postgresql )
|
||||
testRuntime( libraries.mysql )
|
||||
testRuntime( libraries.mariadb )
|
||||
|
||||
if (db.equalsIgnoreCase("oracle")) {
|
||||
dependencies {
|
||||
testRuntime( libraries.oracle )
|
||||
}
|
||||
}
|
||||
|
||||
if (db.equalsIgnoreCase("mssql")) {
|
||||
dependencies {
|
||||
testRuntime( libraries.mssql )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processTestResources.doLast( {
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.testing.RequiresDialect;
|
|||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
@RequiresDialect( value = H2Dialect.class)
|
||||
@RequiresDialect(H2Dialect.class)
|
||||
public class DatabaseMultiTenancyTest extends AbstractMultiTenancyTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.testing.RequiresDialect;
|
|||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
@RequiresDialect( value = H2Dialect.class)
|
||||
@RequiresDialect(H2Dialect.class)
|
||||
public class SchemaMultiTenancyTest extends AbstractMultiTenancyTest {
|
||||
|
||||
public static final String SCHEMA_TOKEN = ";INIT=CREATE SCHEMA IF NOT EXISTS %1$s\\;SET SCHEMA %1$s";
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.userguide.sql;
|
||||
|
||||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.ElementCollection;
|
||||
|
@ -23,8 +24,12 @@ import org.hibernate.annotations.SQLDelete;
|
|||
import org.hibernate.annotations.SQLDeleteAll;
|
||||
import org.hibernate.annotations.SQLInsert;
|
||||
import org.hibernate.annotations.SQLUpdate;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.RequiresDialects;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -39,6 +44,7 @@ import static org.junit.Assert.assertEquals;
|
|||
*
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
@RequiresDialects(value = {@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL82Dialect.class)})
|
||||
public class CollectionLoaderTest extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
private static final Logger log = Logger.getLogger( CollectionLoaderTest.class );
|
||||
|
@ -56,8 +62,10 @@ public class CollectionLoaderTest extends BaseEntityManagerFunctionalTestCase {
|
|||
Session session = entityManager.unwrap( Session.class );
|
||||
session.doWork( connection -> {
|
||||
try(Statement statement = connection.createStatement(); ) {
|
||||
statement.executeUpdate( "ALTER TABLE person ADD COLUMN valid boolean" );
|
||||
statement.executeUpdate( "ALTER TABLE Person_phones ADD COLUMN valid boolean" );
|
||||
statement.executeUpdate( String.format( "ALTER TABLE person %s valid %s",
|
||||
getDialect().getAddColumnString(), getDialect().getTypeName( Types.BOOLEAN )));
|
||||
statement.executeUpdate( String.format( "ALTER TABLE Person_phones %s valid %s",
|
||||
getDialect().getAddColumnString(), getDialect().getTypeName( Types.BOOLEAN )));
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
|
|
@ -22,8 +22,12 @@ import org.hibernate.annotations.Loader;
|
|||
import org.hibernate.annotations.ResultCheckStyle;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.SQLInsert;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.RequiresDialects;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -36,6 +40,7 @@ import static org.junit.Assert.assertNull;
|
|||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
@RequiresDialects(value = {@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL82Dialect.class)})
|
||||
public class CustomSQLSecondaryTableTest extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
private static final Logger log = Logger.getLogger( CustomSQLSecondaryTableTest.class );
|
||||
|
|
|
@ -24,8 +24,12 @@ import org.hibernate.annotations.SQLDeleteAll;
|
|||
import org.hibernate.annotations.SQLInsert;
|
||||
import org.hibernate.annotations.SQLUpdate;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.RequiresDialects;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -38,6 +42,7 @@ import static org.junit.Assert.assertNull;
|
|||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
@RequiresDialects(value = {@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL82Dialect.class)})
|
||||
public class CustomSQLTest extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
private static final Logger log = Logger.getLogger( CustomSQLTest.class );
|
||||
|
|
|
@ -164,8 +164,6 @@ xjc {
|
|||
//sourceSets.main.sourceGeneratorsTask.dependsOn generateGrammarSource
|
||||
tasks.compile.dependsOn generateGrammarSource
|
||||
|
||||
|
||||
|
||||
task copyBundleResources (type: Copy) {
|
||||
ext.bundlesTargetDir = file( "${buildDir}/bundles" )
|
||||
from file('src/test/bundles')
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.persistence.criteria.CriteriaQuery;
|
|||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -31,7 +32,8 @@ import static org.junit.Assert.assertEquals;
|
|||
* @author Janario Oliveira
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class EntitySuperclassCollectionTest extends BaseEntityManagerFunctionalTestCase {
|
||||
public class EntitySuperclassCollectionTest
|
||||
extends BaseEntityManagerFunctionalTestCase {
|
||||
@Override
|
||||
protected Class<?>[] getAnnotatedClasses() {
|
||||
return new Class[] {
|
||||
|
@ -40,7 +42,7 @@ public class EntitySuperclassCollectionTest extends BaseEntityManagerFunctionalT
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10556")
|
||||
@TestForIssue(jiraKey = "HHH-10556")
|
||||
public void testPerson() {
|
||||
String address = "super-address";
|
||||
|
||||
|
@ -50,10 +52,17 @@ public class EntitySuperclassCollectionTest extends BaseEntityManagerFunctionalT
|
|||
}
|
||||
|
||||
private void assertAddress(PersonBase person, String address) {
|
||||
List<Object> results = find( person.getClass(), person.id, "addresses" );
|
||||
List<Object> results = find(
|
||||
person.getClass(),
|
||||
person.id,
|
||||
"addresses"
|
||||
);
|
||||
assertEquals( 1, results.size() );
|
||||
|
||||
assertEquals( person.addresses.get( 0 ).id, ( (Address) results.get( 0 ) ).id );
|
||||
assertEquals(
|
||||
person.addresses.get( 0 ).id,
|
||||
( (Address) results.get( 0 ) ).id
|
||||
);
|
||||
assertEquals( address, ( (Address) results.get( 0 ) ).name );
|
||||
|
||||
getOrCreateEntityManager().close();
|
||||
|
@ -83,7 +92,7 @@ public class EntitySuperclassCollectionTest extends BaseEntityManagerFunctionalT
|
|||
return query.getResultList();
|
||||
}
|
||||
|
||||
@Entity(name="Address")
|
||||
@Entity(name = "Address")
|
||||
public static class Address {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
|
@ -98,7 +107,7 @@ public class EntitySuperclassCollectionTest extends BaseEntityManagerFunctionalT
|
|||
}
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "PersonBase")
|
||||
public abstract static class PersonBase {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
|
@ -107,7 +116,7 @@ public class EntitySuperclassCollectionTest extends BaseEntityManagerFunctionalT
|
|||
List<Address> addresses = new ArrayList<Address>();
|
||||
}
|
||||
|
||||
@Entity(name="Person")
|
||||
@Entity(name = "Person")
|
||||
public static class Person extends PersonBase {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,16 @@
|
|||
*/
|
||||
package org.hibernate.jpa.test.lock;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Id;
|
||||
|
@ -22,16 +30,11 @@ import org.hibernate.jpa.QueryHints;
|
|||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
@ -327,6 +330,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase {
|
|||
* lock some entities via a query and check the resulting lock mode type via EntityManager
|
||||
*/
|
||||
@Test
|
||||
@RequiresDialectFeature( value = DialectChecks.DoesNotSupportFollowOnLocking.class)
|
||||
public void testEntityLockModeStateAfterQueryLocking() {
|
||||
// Create some test data
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
|
|
|
@ -412,7 +412,8 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
|
|||
@SkipForDialects(
|
||||
value = {
|
||||
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
|
||||
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
|
||||
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
|
||||
@SkipForDialect(value = Oracle8iDialect.class, comment = "ORA-00932: inconsistent datatypes: expected NUMBER got BINARY")
|
||||
}
|
||||
)
|
||||
public void testNativeQueryNullPositionalParameterParameter() throws Exception {
|
||||
|
@ -505,7 +506,8 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
|
|||
@SkipForDialects(
|
||||
value = {
|
||||
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
|
||||
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
|
||||
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
|
||||
@SkipForDialect(value = Oracle8iDialect.class, comment = "ORA-00932: inconsistent datatypes: expected NUMBER got BINARY")
|
||||
}
|
||||
)
|
||||
public void testNativeQueryNullNamedParameterParameter() throws Exception {
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
*/
|
||||
package org.hibernate.test.annotations.indexcoll;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
@ -14,20 +22,13 @@ import org.hibernate.dialect.HSQLDialect;
|
|||
import org.hibernate.dialect.TeradataDialect;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Column;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
@ -496,7 +497,7 @@ public class IndexedCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
assertEquals( 1, atm.colorPerDate.size() );
|
||||
final Date date = atm.colorPerDate.keySet().iterator().next();
|
||||
final long diff = new Date( 1234567000 ).getTime() - date.getTime();
|
||||
assertTrue( "24h diff max", diff > 0 && diff < 24*60*60*1000 );
|
||||
assertTrue( "24h diff max", diff >= 0 && diff < 24*60*60*1000 );
|
||||
tx.rollback();
|
||||
s.close();
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class EagerIndexedCollectionTest extends BaseNonConfigCoreFunctionalTestC
|
|||
assertEquals( 1, atm.colorPerDate.size() );
|
||||
final Date date = atm.colorPerDate.keySet().iterator().next();
|
||||
final long diff = new Date( 1234567000 ).getTime() - date.getTime();
|
||||
assertTrue( "24h diff max", diff > 0 && diff < 24*60*60*1000 );
|
||||
assertTrue( "24h diff max", diff >= 0 && diff < 24*60*60*1000 );
|
||||
tx.rollback();
|
||||
s.close();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,15 @@ import java.util.List;
|
|||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.dialect.PostgreSQL9Dialect;
|
||||
import org.hibernate.dialect.PostgresPlusDialect;
|
||||
import org.hibernate.engine.query.spi.HQLQueryPlan;
|
||||
import org.hibernate.exception.SQLGrammarException;
|
||||
import org.hibernate.hql.spi.QueryTranslator;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.SkipForDialects;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -59,6 +65,7 @@ public class CompositeIdTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SkipForDialect(value = Oracle8iDialect.class, comment = "Cannot count distinct over multiple columns in Oracle")
|
||||
public void testDistinctCountOfEntityWithCompositeId() {
|
||||
// today we do not account for Dialects supportsTupleDistinctCounts() is false. though really the only
|
||||
// "option" there is to throw an error.
|
||||
|
|
|
@ -93,7 +93,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
MapValue foundValue = found.enumDefaultType.get( EnumMapKey.VALUE_1 );
|
||||
assertEquals( EnumMapKey.VALUE_1, foundValue.enumDefault );
|
||||
|
||||
assertEquals( 0, findDatabaseValue( foundValue, "enumDefault" ) );
|
||||
assertEquals( 0, ((Number) findDatabaseValue( foundValue, "enumDefault" )).intValue() );
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
MapValue foundValue = found.enumExplicitOrdinalType.get( EnumMapKey.VALUE_2 );
|
||||
assertEquals( EnumMapKey.VALUE_2, foundValue.enumExplicitOrdinal );
|
||||
|
||||
assertEquals( 1, findDatabaseValue( foundValue, "enumExplicitOrdinal" ) );
|
||||
assertEquals( 1, ((Number) findDatabaseValue( foundValue, "enumExplicitOrdinal" )).intValue() );
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
MapValue foundValue = found.enumImplicitOverrideOrdinalType.get( ImplicitEnumMapKey.VALUE_1 );
|
||||
assertEquals( ImplicitEnumMapKey.VALUE_1, foundValue.enumImplicitOverrideOrdinal );
|
||||
|
||||
assertEquals( 0, findDatabaseValue( foundValue, "enumImplicitOverrideOrdinal" ) );
|
||||
assertEquals( 0, ((Number) findDatabaseValue( foundValue, "enumImplicitOverrideOrdinal" )).intValue() );
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
@Table(name = "map_entity")
|
||||
public static class MapEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@OneToMany(mappedBy = "mapEntity", cascade = CascadeType.ALL)
|
||||
|
@ -280,7 +280,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
@Table(name = "map_value")
|
||||
public static class MapValue {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Integer id;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "map_entity_id")
|
||||
|
|
|
@ -85,7 +85,7 @@ public class InheritanceManyToManyForeignKeyTest extends BaseNonConfigCoreFuncti
|
|||
session.close();
|
||||
}
|
||||
|
||||
@Entity(name = "LocalDateEvent")
|
||||
@Entity(name = "LDE")
|
||||
public static class LocalDateEvent {
|
||||
|
||||
@Id
|
||||
|
@ -107,7 +107,7 @@ public class InheritanceManyToManyForeignKeyTest extends BaseNonConfigCoreFuncti
|
|||
}
|
||||
}
|
||||
|
||||
@Entity(name = "UserEvents")
|
||||
@Entity(name = "UE")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
public static class UserEvents extends AbstractEventsEntityModel {
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class InheritanceManyToManyForeignKeyTest extends BaseNonConfigCoreFuncti
|
|||
|
||||
}
|
||||
|
||||
@Entity(name = "ApplicationEvents")
|
||||
@Entity(name = "AE")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
public static class ApplicationEvents extends AbstractEventsEntityModel {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import javax.persistence.PersistenceException;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.exception.SQLGrammarException;
|
||||
import org.hibernate.hql.internal.ast.QueryTranslatorImpl;
|
||||
import org.hibernate.hql.internal.ast.tree.SelectClause;
|
||||
|
@ -25,6 +26,7 @@ import org.hibernate.type.BigIntegerType;
|
|||
import org.hibernate.type.DoubleType;
|
||||
import org.hibernate.type.LongType;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
@ -206,6 +208,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SkipForDialect(value = Oracle8iDialect.class, comment = "Cannot count distinct over multiple columns in Oracle")
|
||||
public void testCountReturnValues() {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.hibernate.cfg.AvailableSettings;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.MySQL5Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL94Dialect;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.tool.schema.Action;
|
||||
|
@ -30,7 +29,7 @@ import org.hibernate.type.PostgresUUIDType;
|
|||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.UUIDBinaryType;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
|
@ -103,7 +102,7 @@ public class UUIDBasedIdInterpretationTest extends BaseUnitTestCase {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10564")
|
||||
@SkipForDialect(PostgreSQL81Dialect.class)
|
||||
@RequiresDialect(H2Dialect.class)
|
||||
public void testBinaryRuntimeUsage() {
|
||||
StandardServiceRegistry ssr = buildStandardServiceRegistry( H2Dialect.class, true );
|
||||
try {
|
||||
|
|
|
@ -93,9 +93,12 @@ public class SchemaExportTest extends BaseUnitTestCase {
|
|||
|
||||
// drop beforeQuery create again (this time drops the tables beforeQuery re-creating)
|
||||
schemaExport.execute( EnumSet.of( TargetType.DATABASE ), SchemaExport.Action.BOTH, metadata );
|
||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||
int exceptionCount = schemaExport.getExceptions().size();
|
||||
if ( doesDialectSupportDropTableIfExist() ) {
|
||||
assertEquals( 0, exceptionCount);
|
||||
}
|
||||
|
||||
// drop tables
|
||||
// drop tables
|
||||
schemaExport.execute( EnumSet.of( TargetType.DATABASE ), SchemaExport.Action.DROP, metadata );
|
||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||
}
|
||||
|
|
|
@ -19,16 +19,17 @@ import org.hibernate.tool.schema.TargetType;
|
|||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Koen Aers
|
||||
*/
|
||||
@RequiresDialect(H2Dialect.class)
|
||||
@TestForIssue(jiraKey = "HHH-10158")
|
||||
@RequiresDialect( H2Dialect.class )
|
||||
public class SchemaUpdateFormatterTest {
|
||||
|
||||
public class SchemaUpdateFormatterTest extends BaseUnitTestCase {
|
||||
|
||||
private static final String AFTER_FORMAT =
|
||||
"\n\\s+create table test_entity \\(\n" +
|
||||
"\\s+field varchar\\(255\\) not null,\n" +
|
||||
|
|
|
@ -39,6 +39,8 @@ import org.hibernate.tool.schema.spi.SchemaManagementTool;
|
|||
import org.hibernate.tool.schema.spi.ScriptSourceInput;
|
||||
import org.hibernate.tool.schema.spi.SourceDescriptor;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.hibernate.test.tool.schema.TargetDatabaseImpl;
|
||||
|
@ -52,7 +54,7 @@ import static org.junit.Assert.assertThat;
|
|||
/**
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
|
||||
@RequiresDialectFeature( value = DialectChecks.SupportSchemaCreation.class)
|
||||
public class CrossSchemaForeignKeyGenerationTest extends BaseUnitTestCase {
|
||||
private File output;
|
||||
private StandardServiceRegistry ssr;
|
||||
|
|
|
@ -16,12 +16,16 @@ import org.hibernate.tool.hbm2ddl.SchemaExport;
|
|||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||
import org.hibernate.tool.schema.TargetType;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
public class InheritanceSchemaUpdateTest {
|
||||
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class)
|
||||
public class InheritanceSchemaUpdateTest extends BaseUnitTestCase {
|
||||
|
||||
@Test
|
||||
public void testBidirectionalOneToManyReferencingRootEntity() throws Exception {
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
*/
|
||||
package org.hibernate.test.sql.check;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.Session;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -35,11 +33,11 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
s.flush();
|
||||
fail( "expection flush failure!" );
|
||||
}
|
||||
catch( JDBCException ex ) {
|
||||
catch( Exception ex ) {
|
||||
// these should specifically be JDBCExceptions...
|
||||
}
|
||||
s.clear();
|
||||
s.getTransaction().commit();
|
||||
s.getTransaction().rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
|
@ -54,11 +52,11 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
s.flush();
|
||||
fail( "expection flush failure!" );
|
||||
}
|
||||
catch( HibernateException ex ) {
|
||||
catch( Exception ex ) {
|
||||
// these should specifically be HibernateExceptions...
|
||||
}
|
||||
s.clear();
|
||||
s.getTransaction().commit();
|
||||
s.getTransaction().rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
|
@ -74,11 +72,11 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
s.flush();
|
||||
fail( "expection flush failure!" );
|
||||
}
|
||||
catch( JDBCException ex ) {
|
||||
catch( Exception ex ) {
|
||||
// these should specifically be JDBCExceptions...
|
||||
}
|
||||
s.clear();
|
||||
s.getTransaction().commit();
|
||||
s.getTransaction().rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
|
@ -94,11 +92,11 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
s.flush();
|
||||
fail( "expection flush failure!" );
|
||||
}
|
||||
catch( HibernateException ex ) {
|
||||
catch( Exception ex ) {
|
||||
// these should specifically be HibernateExceptions...
|
||||
}
|
||||
s.clear();
|
||||
s.getTransaction().commit();
|
||||
s.getTransaction().rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
|
@ -114,11 +112,11 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
s.flush();
|
||||
fail( "expection flush failure!" );
|
||||
}
|
||||
catch( JDBCException ex ) {
|
||||
catch( Exception ex ) {
|
||||
// these should specifically be JDBCExceptions...
|
||||
}
|
||||
s.clear();
|
||||
s.getTransaction().commit();
|
||||
s.getTransaction().rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
|
@ -134,11 +132,11 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
s.flush();
|
||||
fail( "expection flush failure!" );
|
||||
}
|
||||
catch( HibernateException ex ) {
|
||||
catch( Exception ex ) {
|
||||
// these should specifically be HibernateExceptions...
|
||||
}
|
||||
s.clear();
|
||||
s.getTransaction().commit();
|
||||
s.getTransaction().rollback();
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,5 @@ hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFa
|
|||
|
||||
javax.persistence.validation.mode=NONE
|
||||
hibernate.service.allow_crawling=false
|
||||
hibernate.session.events.log=true
|
||||
hibernate.session.events.log=true
|
||||
hibernate.hql.bulk_id_strategy.global_temporary.drop_tables=true
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.envers.test.integration.query.entities;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
@ -21,6 +22,8 @@ public class Address {
|
|||
private Long id;
|
||||
|
||||
private String street;
|
||||
|
||||
@Column(name = "`number`")
|
||||
private int number;
|
||||
|
||||
public Address() {
|
||||
|
|
|
@ -189,4 +189,10 @@ abstract public class DialectChecks {
|
|||
return dialect.supportsRowValueConstructorSyntax() == false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportFollowOnLocking implements DialectCheck {
|
||||
public boolean isMatch(Dialect dialect) {
|
||||
return !dialect.useFollowOnLocking();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue