diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/notfound/NotFoundTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/notfound/NotFoundTest.java index 9957692081..6da8da6d4a 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/notfound/NotFoundTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/notfound/NotFoundTest.java @@ -10,6 +10,8 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.Transaction; +import org.hibernate.testing.DialectChecks; +import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertNull; @@ -17,6 +19,7 @@ import static org.junit.Assert.assertNull; /** * @author Emmanuel Bernard */ +@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class) public class NotFoundTest extends BaseCoreFunctionalTestCase { @Test public void testManyToOne() throws Exception { diff --git a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/cache/LazyInCacheTestTask.java b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/cache/LazyInCacheTestTask.java index 3c961298a5..f10f6b55b9 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/cache/LazyInCacheTestTask.java +++ b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/cache/LazyInCacheTestTask.java @@ -66,7 +66,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask { protected void cleanup() { } - @Entity + @Entity(name = "Orders") @Cache( usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE ) public static class Order { @@ -81,13 +81,12 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask { List tags = new ArrayList<>(); @Basic( fetch = FetchType.LAZY ) - @Column @Type( type = "org.hibernate.type.BinaryType" ) private byte[] data; } - @Entity + @Entity(name = "Product") public static class Product { @Id @@ -98,8 +97,8 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask { } - @Entity - public static class Tag { + @Entity(name = "Tag") + public class Tag { @Id @GeneratedValue( strategy = GenerationType.IDENTITY ) diff --git a/hibernate-core/src/test/java/org/hibernate/test/jdbc/internal/BasicConnectionTest.java b/hibernate-core/src/test/java/org/hibernate/test/jdbc/internal/BasicConnectionTest.java index a978cddd0e..762bc1ead6 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/jdbc/internal/BasicConnectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/jdbc/internal/BasicConnectionTest.java @@ -87,7 +87,16 @@ public class BasicConnectionTest extends BaseCoreFunctionalTestCase { fail( "incorrect exception type : sqlexception" ); } finally { - session.close(); + try { + session.doWork( connection -> { + final Statement stmnt = connection.createStatement(); + + stmnt.execute( getDialect().getDropTableString( "SANDBOX_JDBC_TST" ) ); + } ); + } + finally { + session.close(); + } } assertFalse( getResourceRegistry( jdbcCoord ).hasRegisteredResources() ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/tool/schema/SchemaToolTransactionHandlingTest.java b/hibernate-core/src/test/java/org/hibernate/test/tool/schema/SchemaToolTransactionHandlingTest.java index 30a4fc7f11..e41a071b61 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/tool/schema/SchemaToolTransactionHandlingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/tool/schema/SchemaToolTransactionHandlingTest.java @@ -6,6 +6,7 @@ */ package org.hibernate.test.tool.schema; +import java.sql.SQLSyntaxErrorException; import java.util.Collections; import java.util.EnumSet; import javax.persistence.Entity; @@ -21,6 +22,7 @@ import org.hibernate.resource.transaction.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl; import org.hibernate.tool.schema.SourceType; import org.hibernate.tool.schema.TargetType; +import org.hibernate.tool.schema.spi.CommandAcceptanceException; import org.hibernate.tool.schema.spi.SchemaCreator; import org.hibernate.tool.schema.spi.SchemaDropper; import org.hibernate.tool.schema.spi.SchemaManagementTool; @@ -88,12 +90,16 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase { final Metadata mappings = buildMappings( registry ); try { - schemaDropper.doDrop( - mappings, - ExecutionOptionsTestImpl.INSTANCE, - SourceDescriptorImpl.INSTANCE, - TargetDescriptorImpl.INSTANCE - ); + try { + schemaDropper.doDrop( + mappings, + ExecutionOptionsTestImpl.INSTANCE, + SourceDescriptorImpl.INSTANCE, + TargetDescriptorImpl.INSTANCE + ); + }catch (CommandAcceptanceException e){ + //ignore may happen if sql drop does not support if exist + } schemaCreator.doCreation( mappings, ExecutionOptionsTestImpl.INSTANCE, diff --git a/hibernate-ehcache/src/test/java/org/hibernate/test/cache/ehcache/functional/RefreshUpdatedDataTest.java b/hibernate-ehcache/src/test/java/org/hibernate/test/cache/ehcache/functional/RefreshUpdatedDataTest.java index 6cb4491f44..ea8fdd558e 100644 --- a/hibernate-ehcache/src/test/java/org/hibernate/test/cache/ehcache/functional/RefreshUpdatedDataTest.java +++ b/hibernate-ehcache/src/test/java/org/hibernate/test/cache/ehcache/functional/RefreshUpdatedDataTest.java @@ -13,6 +13,7 @@ import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.Table; import javax.persistence.Version; import org.hibernate.Session; @@ -173,6 +174,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase } @Entity(name = "ReadWriteCacheableItem") + @Table(name = "RW_ITEM") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item") public static class ReadWriteCacheableItem { @@ -215,6 +217,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase } @Entity(name = "ReadWriteVersionedCacheableItem") + @Table(name = "RW_VERSIONED_ITEM") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item") public static class ReadWriteVersionedCacheableItem { @@ -260,6 +263,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase } @Entity(name = "NonStrictReadWriteCacheableItem") + @Table(name = "RW_NOSTRICT_ITEM") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item") public static class NonStrictReadWriteCacheableItem { @@ -302,6 +306,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase } @Entity(name = "NonStrictReadWriteVersionedCacheableItem") + @Table(name = "RW_NOSTRICT_VER_ITEM") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item") public static class NonStrictReadWriteVersionedCacheableItem { diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/enhancement/cases/DetachedGetIdentifierTestTask.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/enhancement/cases/DetachedGetIdentifierTestTask.java index ba53492973..806a1d4944 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/enhancement/cases/DetachedGetIdentifierTestTask.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/enhancement/cases/DetachedGetIdentifierTestTask.java @@ -52,7 +52,7 @@ public class DetachedGetIdentifierTestTask extends AbstractExecutable { protected void cleanup() { } - @Entity + @Entity(name = "SimpleEntity") public static class SimpleEntity { @Id diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/lock/LockTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/lock/LockTest.java index 454a9c99a8..bfbd021249 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/lock/LockTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/lock/LockTest.java @@ -15,7 +15,6 @@ import org.hibernate.ejb.AvailableSettings; import org.hibernate.ejb.QueryHints; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; -import org.hibernate.testing.*; import org.jboss.logging.Logger; import org.junit.Test; @@ -28,6 +27,14 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; +import org.hibernate.testing.DialectChecks; +import org.hibernate.testing.FailureExpected; +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.RequiresDialectFeature; +import org.hibernate.testing.SkipForDialect; +import org.hibernate.testing.SkipForDialects; +import org.hibernate.testing.TestForIssue; + import static org.junit.Assert.*; /** @@ -66,7 +73,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { @Test(timeout = 5 * 60 * 1000) //5 minutes @TestForIssue( jiraKey = "HHH-7252" ) - @RequiresDialectFeature( value = DialectChecks.SupportsLockTimeouts.class, + @RequiresDialectFeature( value = DialectChecks.SupportsLockTimeouts.class, comment = "Test verifies proper exception throwing when a lock timeout is specified.", jiraKey = "HHH-7252" ) public void testFindWithPessimisticWriteLockTimeoutException() { @@ -98,9 +105,12 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { fail( "Find with immediate timeout should have thrown LockTimeoutException." ); } catch (PersistenceException pe) { - log.info("EntityManager.find() for PESSIMISTIC_WRITE with timeout of 0 threw a PersistenceException.\n" + - "This is likely a consequence of " + getDialect().getClass().getName() + " not properly mapping SQL errors into the correct HibernateException subtypes.\n" + - "See HHH-7251 for an example of one such situation.", pe); + log.info( + "EntityManager.find() for PESSIMISTIC_WRITE with timeout of 0 threw a PersistenceException.\n" + + "This is likely a consequence of " + getDialect().getClass() + .getName() + " not properly mapping SQL errors into the correct HibernateException subtypes.\n" + + "See HHH-7251 for an example of one such situation.", pe + ); fail( "EntityManager should be throwing LockTimeoutException." ); } finally { diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/MonotonicRevisionNumberTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/MonotonicRevisionNumberTest.java index dcb87e4d72..6b9274973d 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/MonotonicRevisionNumberTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/MonotonicRevisionNumberTest.java @@ -38,7 +38,7 @@ public class MonotonicRevisionNumberTest extends BaseEnversFunctionalTestCase { OrderedSequenceGenerator seqGenerator = (OrderedSequenceGenerator) generator; Assert.assertTrue( "Oracle sequence needs to be ordered in RAC environment.", - seqGenerator.sqlCreateStrings( getDialect() )[0].endsWith( " order" ) + seqGenerator.sqlCreateStrings( getDialect() )[0].toLowerCase().endsWith( " order" ) ); } }