HHH-11536 - Fix unit tests failing on Oracle

This commit is contained in:
Andrea Boriero 2017-03-01 13:47:27 +00:00
parent 2a32c8ff0d
commit e54ce7b266
31 changed files with 104 additions and 44 deletions

View File

@ -7,6 +7,7 @@
package org.hibernate.jpa.test.criteria.components; package org.hibernate.jpa.test.criteria.components;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection; import javax.persistence.ElementCollection;
import javax.persistence.Embeddable; import javax.persistence.Embeddable;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -304,6 +305,7 @@ public class ComponentInWhereClauseTest extends BaseEntityManagerFunctionalTestC
@Embeddable @Embeddable
public static class Phone { public static class Phone {
@Column(name = "phone_number")
private String number; private String number;
public Phone() { public Phone() {

View File

@ -11,6 +11,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection; import javax.persistence.ElementCollection;
import javax.persistence.Embeddable; import javax.persistence.Embeddable;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -237,6 +238,7 @@ public class EntitySuperclassComponentWithCollectionTest extends BaseEntityManag
@Embeddable @Embeddable
public static class Phone { public static class Phone {
@Column(name = "phone_number")
private String number; private String number;
public Phone() { public Phone() {

View File

@ -11,6 +11,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection; import javax.persistence.ElementCollection;
import javax.persistence.Embeddable; import javax.persistence.Embeddable;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -236,6 +237,7 @@ public class MappedSuperclassComponentWithCollectionTest extends BaseEntityManag
@Embeddable @Embeddable
public static class Phone { public static class Phone {
@Column(name = "phone_number")
private String number; private String number;
public Phone() { public Phone() {

View File

@ -31,6 +31,7 @@ import org.hibernate.jpa.QueryHints;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.DialectChecks; import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialect;
@ -719,6 +720,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
@Test @Test
@RequiresDialect( Oracle10gDialect.class ) @RequiresDialect( Oracle10gDialect.class )
@RequiresDialectFeature( DialectChecks.SupportsLockTimeouts.class ) @RequiresDialectFeature( DialectChecks.SupportsLockTimeouts.class )
@FailureExpected( jiraKey = "HHH-8001" )
public void testQueryTimeout() throws Exception { public void testQueryTimeout() throws Exception {
EntityManager em = getOrCreateEntityManager(); EntityManager em = getOrCreateEntityManager();
@ -812,6 +814,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
@Test @Test
@RequiresDialect( Oracle10gDialect.class ) @RequiresDialect( Oracle10gDialect.class )
@RequiresDialectFeature( DialectChecks.SupportsLockTimeouts.class ) @RequiresDialectFeature( DialectChecks.SupportsLockTimeouts.class )
@FailureExpected( jiraKey = "HHH-8001" )
public void testQueryTimeoutEMProps() throws Exception { public void testQueryTimeoutEMProps() throws Exception {
EntityManager em = getOrCreateEntityManager(); EntityManager em = getOrCreateEntityManager();
Map<String, Object> queryTimeoutProps = new HashMap<String, Object>(); Map<String, Object> queryTimeoutProps = new HashMap<String, Object>();

View File

@ -19,6 +19,8 @@ import javax.persistence.OneToOne;
import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction; import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test; import org.junit.Test;
@ -28,6 +30,7 @@ import static org.junit.Assert.assertNull;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class)
public class NotFoundTest extends BaseCoreFunctionalTestCase { public class NotFoundTest extends BaseCoreFunctionalTestCase {
@Test @Test

View File

@ -10,7 +10,9 @@ import org.hibernate.bytecode.enhance.spi.UnloadedClass;
import org.hibernate.test.bytecode.enhancement.detached.DetachedGetIdentifierTestTask; import org.hibernate.test.bytecode.enhancement.detached.DetachedGetIdentifierTestTask;
import org.hibernate.test.bytecode.enhancement.cascade.CascadeWithFkConstraintTestTask; import org.hibernate.test.bytecode.enhancement.cascade.CascadeWithFkConstraintTestTask;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpected; import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.EnhancerTestContext; import org.hibernate.testing.bytecode.enhancement.EnhancerTestContext;
import org.hibernate.testing.bytecode.enhancement.EnhancerTestUtils; import org.hibernate.testing.bytecode.enhancement.EnhancerTestUtils;
@ -131,6 +133,7 @@ public class EnhancerTest extends BaseUnitTestCase {
@Test @Test
@TestForIssue( jiraKey = "HHH-11173" ) @TestForIssue( jiraKey = "HHH-11173" )
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class)
public void testLazyCache() { public void testLazyCache() {
EnhancerTestUtils.runEnhancerTestTask( LazyInCacheTestTask.class ); EnhancerTestUtils.runEnhancerTestTask( LazyInCacheTestTask.class );
} }

View File

@ -46,7 +46,7 @@ public class DetachedGetIdentifierTestTask extends AbstractEnhancerTestTask {
protected void cleanup() { protected void cleanup() {
} }
@Entity @Entity(name = "SimpleEntity")
public static class SimpleEntity { public static class SimpleEntity {
@Id @Id

View File

@ -66,7 +66,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask {
protected void cleanup() { protected void cleanup() {
} }
@Entity @Entity(name = "Order")
@Cache( usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE ) @Cache( usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE )
public static class Order { public static class Order {
@ -87,7 +87,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask {
} }
@Entity @Entity(name = "Product")
public static class Product { public static class Product {
@Id @Id
@ -98,7 +98,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask {
} }
@Entity @Entity(name = "Tag")
public class Tag { public class Tag {
@Id @Id

View File

@ -7,6 +7,7 @@
package org.hibernate.test.converter; package org.hibernate.test.converter;
import javax.persistence.AttributeConverter; import javax.persistence.AttributeConverter;
import javax.persistence.Column;
import javax.persistence.Convert; import javax.persistence.Convert;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -103,6 +104,7 @@ public class LongToDateConversionTest extends BaseCoreFunctionalTestCase {
private long id; private long id;
@Convert(converter = DateAttributeConverter.class) @Convert(converter = DateAttributeConverter.class)
@Column(name = "attribute_date")
private DateAttribute date; private DateAttribute date;
public DateAttribute getDate() { public DateAttribute getDate() {

View File

@ -83,7 +83,7 @@ public class NonTransactionalDataAccessTest extends BaseCoreFunctionalTestCase {
} }
@Test(expected = TransactionRequiredException.class) @Test(expected = TransactionRequiredException.class)
public void testFlushDisallowingutOfTransactionUpdateOperations() throws Exception { public void testFlushDisallowingOutOfTransactionUpdateOperations() throws Exception {
allowUpdateOperationOutsideTransaction = "false"; allowUpdateOperationOutsideTransaction = "false";
rebuildSessionFactory(); rebuildSessionFactory();
prepareTest(); prepareTest();
@ -115,7 +115,7 @@ public class NonTransactionalDataAccessTest extends BaseCoreFunctionalTestCase {
@Entity(name = "MyEntity") @Entity(name = "MyEntity")
public static class MyEntity { public static class MyEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue
long id; long id;
String name; String name;

View File

@ -87,21 +87,19 @@ public class BasicConnectionTest extends BaseCoreFunctionalTestCase {
fail( "incorrect exception type : sqlexception" ); fail( "incorrect exception type : sqlexception" );
} }
finally { finally {
session.close(); try {
}
assertFalse( getResourceRegistry( jdbcCoord ).hasRegisteredResources() );
}
@Override
protected void cleanupTest() throws Exception {
try (Session session = openSession()) {
session.doWork( connection -> { session.doWork( connection -> {
final Statement stmnt = connection.createStatement(); final Statement stmnt = connection.createStatement();
stmnt.execute( getDialect().getDropTableString( "SANDBOX_JDBC_TST" ) ); stmnt.execute( getDialect().getDropTableString( "SANDBOX_JDBC_TST" ) );
} ); } );
} }
finally {
session.close();
}
}
assertFalse( getResourceRegistry( jdbcCoord ).hasRegisteredResources() );
} }
private ResourceRegistry getResourceRegistry(JdbcCoordinator jdbcCoord) { private ResourceRegistry getResourceRegistry(JdbcCoordinator jdbcCoord) {

View File

@ -16,9 +16,11 @@ import javax.persistence.Id;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.engine.jdbc.ClobProxy; import org.hibernate.engine.jdbc.ClobProxy;
import org.hibernate.query.Query; import org.hibernate.query.Query;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.testing.transaction.TransactionUtil;
@ -32,6 +34,7 @@ import static org.junit.Assert.fail;
* @author Andrea Boriero * @author Andrea Boriero
*/ */
@TestForIssue(jiraKey = "HHH-11477") @TestForIssue(jiraKey = "HHH-11477")
@SkipForDialect(Oracle8iDialect.class)
public class LobStringTest extends BaseCoreFunctionalTestCase { public class LobStringTest extends BaseCoreFunctionalTestCase {
private static final int LONG_STRING_SIZE = 10000; private static final int LONG_STRING_SIZE = 10000;

View File

@ -10,9 +10,11 @@ import java.util.List;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.query.Query; import org.hibernate.query.Query;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.testing.transaction.TransactionUtil;
@ -97,6 +99,7 @@ public abstract class LongStringTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(Oracle8iDialect.class)
@TestForIssue( jiraKey = "HHH-11477") @TestForIssue( jiraKey = "HHH-11477")
public void testUsingLobPropertyInHqlQuery() { public void testUsingLobPropertyInHqlQuery() {
TransactionUtil.doInHibernate( this::sessionFactory, session -> { TransactionUtil.doInHibernate( this::sessionFactory, session -> {
@ -116,6 +119,7 @@ public abstract class LongStringTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(Oracle8iDialect.class)
@TestForIssue( jiraKey = "HHH-11477") @TestForIssue( jiraKey = "HHH-11477")
public void testSelectLobPropertyInHqlQuery() { public void testSelectLobPropertyInHqlQuery() {
TransactionUtil.doInHibernate( this::sessionFactory, session -> { TransactionUtil.doInHibernate( this::sessionFactory, session -> {

View File

@ -303,7 +303,6 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa
} }
@Test @Test
@FailureExpected( jiraKey = "HHH-10898")
public void testNamedNativeQueryStoredProcedureRefCursor() { public void testNamedNativeQueryStoredProcedureRefCursor() {
EntityManager entityManager = createEntityManager(); EntityManager entityManager = createEntityManager();
entityManager.getTransaction().begin(); entityManager.getTransaction().begin();

View File

@ -11,13 +11,12 @@ package org.hibernate.test.subquery;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.dialect.MariaDBDialect; import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.function.SQLFunction; import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.engine.spi.Mapping; import org.hibernate.engine.spi.Mapping;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.Type; import org.hibernate.type.Type;
import org.junit.Test; import org.junit.Test;
@ -31,7 +30,7 @@ import java.util.function.Consumer;
* *
* @author Christian Beikov * @author Christian Beikov
*/ */
@SkipForDialect(value = MariaDBDialect.class, comment = "This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery") @RequiresDialect(H2Dialect.class)
public class SubqueryTest extends BaseCoreFunctionalTestCase { public class SubqueryTest extends BaseCoreFunctionalTestCase {
private static final SQLFunction LIMIT_FUNCTION = new SQLFunction() { private static final SQLFunction LIMIT_FUNCTION = new SQLFunction() {

View File

@ -6,6 +6,7 @@
*/ */
package org.hibernate.test.tool.schema; package org.hibernate.test.tool.schema;
import java.sql.SQLSyntaxErrorException;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -22,6 +23,7 @@ import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoo
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.tool.schema.SourceType; import org.hibernate.tool.schema.SourceType;
import org.hibernate.tool.schema.TargetType; 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.SchemaCreator;
import org.hibernate.tool.schema.spi.SchemaDropper; import org.hibernate.tool.schema.spi.SchemaDropper;
import org.hibernate.tool.schema.spi.SchemaManagementTool; import org.hibernate.tool.schema.spi.SchemaManagementTool;
@ -88,6 +90,7 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase {
final SchemaCreator schemaCreator = smt.getSchemaCreator( Collections.emptyMap() ); final SchemaCreator schemaCreator = smt.getSchemaCreator( Collections.emptyMap() );
final Metadata mappings = buildMappings( registry ); final Metadata mappings = buildMappings( registry );
try {
try { try {
schemaDropper.doDrop( schemaDropper.doDrop(
mappings, mappings,
@ -95,6 +98,9 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase {
SourceDescriptorImpl.INSTANCE, SourceDescriptorImpl.INSTANCE,
TargetDescriptorImpl.INSTANCE TargetDescriptorImpl.INSTANCE
); );
}catch (CommandAcceptanceException e){
//ignore may happen if sql drop does not support if exist
}
schemaCreator.doCreation( schemaCreator.doCreation(
mappings, mappings,
ExecutionOptionsTestImpl.INSTANCE, ExecutionOptionsTestImpl.INSTANCE,

View File

@ -13,6 +13,7 @@ import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.dialect.MariaDBDialect; import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
@ -27,6 +28,7 @@ import static org.junit.Assert.assertEquals;
*/ */
@TestForIssue(jiraKey = "HHH-10465") @TestForIssue(jiraKey = "HHH-10465")
@SkipForDialect(MariaDBDialect.class) @SkipForDialect(MariaDBDialect.class)
@SkipForDialect(value = Oracle9iDialect.class, comment = "Oracle date does not support milliseconds ")
public class TimeAndTimestampTest extends BaseNonConfigCoreFunctionalTestCase { public class TimeAndTimestampTest extends BaseNonConfigCoreFunctionalTestCase {
@Override @Override

View File

@ -13,6 +13,7 @@ import javax.persistence.ElementCollection;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version; import javax.persistence.Version;
import org.hibernate.Session; import org.hibernate.Session;
@ -173,6 +174,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "ReadWriteCacheableItem") @Entity(name = "ReadWriteCacheableItem")
@Table(name = "RW_ITEM")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item")
public static class ReadWriteCacheableItem { public static class ReadWriteCacheableItem {
@ -215,6 +217,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "ReadWriteVersionedCacheableItem") @Entity(name = "ReadWriteVersionedCacheableItem")
@Table(name = "RW_VERSIONED_ITEM")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item")
public static class ReadWriteVersionedCacheableItem { public static class ReadWriteVersionedCacheableItem {
@ -260,6 +263,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "NonStrictReadWriteCacheableItem") @Entity(name = "NonStrictReadWriteCacheableItem")
@Table(name = "RW_NOSTRICT_ITEM")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item")
public static class NonStrictReadWriteCacheableItem { public static class NonStrictReadWriteCacheableItem {
@ -302,6 +306,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "NonStrictReadWriteVersionedCacheableItem") @Entity(name = "NonStrictReadWriteVersionedCacheableItem")
@Table(name = "RW_NOSTRICT_VER_ITEM")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item")
public static class NonStrictReadWriteVersionedCacheableItem { public static class NonStrictReadWriteVersionedCacheableItem {

View File

@ -15,11 +15,13 @@ import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Lob; import javax.persistence.Lob;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools; import org.hibernate.envers.test.tools.TestTools;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
@ -30,6 +32,7 @@ import static org.junit.Assert.assertEquals;
* @author Chris Cranford * @author Chris Cranford
*/ */
@TestForIssue(jiraKey = "HHH-9834") @TestForIssue(jiraKey = "HHH-9834")
@SkipForDialect(Oracle8iDialect.class)
public class StringMapLobTest extends BaseEnversJPAFunctionalTestCase { public class StringMapLobTest extends BaseEnversJPAFunctionalTestCase {
@Override @Override
protected Class<?>[] getAnnotatedClasses() { protected Class<?>[] getAnnotatedClasses() {

View File

@ -16,11 +16,13 @@ import javax.persistence.Id;
import javax.persistence.Lob; import javax.persistence.Lob;
import org.hibernate.annotations.Nationalized; import org.hibernate.annotations.Nationalized;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.tools.TestTools; import org.hibernate.envers.test.tools.TestTools;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
@ -31,6 +33,7 @@ import static org.junit.Assert.assertEquals;
* @author Chris Cranford * @author Chris Cranford
*/ */
@TestForIssue(jiraKey = "HHH-9834") @TestForIssue(jiraKey = "HHH-9834")
@SkipForDialect(Oracle8iDialect.class)
public class StringMapNationalizedLobTest extends BaseEnversJPAFunctionalTestCase { public class StringMapNationalizedLobTest extends BaseEnversJPAFunctionalTestCase {
@Override @Override
protected Class<?>[] getAnnotatedClasses() { protected Class<?>[] getAnnotatedClasses() {

View File

@ -12,12 +12,14 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
@ -160,7 +162,7 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
return book; return book;
} }
@Entity @Entity(name = "Author")
@Audited @Audited
public static class Author { public static class Author {
@Id @Id
@ -171,8 +173,7 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
private String lastName; private String lastName;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "author")
@JoinColumn(name = "author_id", referencedColumnName = "id", nullable = false)
private List<Book> books; private List<Book> books;
public Integer getId() { public Integer getId() {
@ -244,7 +245,7 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
} }
} }
@Entity @Entity(name = "Book")
@Audited @Audited
public static class Book { public static class Book {
@Id @Id
@ -254,7 +255,8 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
private String title; private String title;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "author_id", nullable = false, insertable = false, updatable = false) @JoinTable(name = "author_book",
joinColumns = @JoinColumn(name = "book_id"), inverseJoinColumns = @JoinColumn(name="author_id",nullable = false))
@NotAudited @NotAudited
private Author author; private Author author;

View File

@ -19,6 +19,7 @@ import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
@ -161,7 +162,7 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
return book; return book;
} }
@Entity @Entity(name = "Author")
@Audited @Audited
public static class Author { public static class Author {
@Id @Id
@ -172,8 +173,7 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
private String lastName; private String lastName;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "author")
@JoinColumn(name = "author_id", referencedColumnName = "id", nullable = false)
private Set<Book> books; private Set<Book> books;
public Integer getId() { public Integer getId() {
@ -245,7 +245,7 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
} }
} }
@Entity @Entity(name = "Book")
@Audited @Audited
public static class Book { public static class Book {
@Id @Id
@ -255,7 +255,8 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
private String title; private String title;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "author_id", nullable = false, insertable = false, updatable = false) @JoinTable(name = "author_book",
joinColumns = @JoinColumn(name = "book_id"), inverseJoinColumns = @JoinColumn(name="author_id",nullable = false))
@NotAudited @NotAudited
private Author author; private Author author;

View File

@ -19,6 +19,7 @@ public class CorrectChildId implements Serializable {
@Column(name = "parent_id") @Column(name = "parent_id")
private String id; private String id;
@Column(name = "child_number")
private Integer number; private Integer number;
CorrectChildId() { CorrectChildId() {

View File

@ -8,6 +8,7 @@ package org.hibernate.envers.test.integration.ids.embeddedid;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable; import javax.persistence.Embeddable;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns; import javax.persistence.JoinColumns;
@ -22,6 +23,7 @@ public class IncorrectChildId implements Serializable {
@JoinColumns({ @JoinColumn(name = "parent_id", referencedColumnName = "id") }) @JoinColumns({ @JoinColumn(name = "parent_id", referencedColumnName = "id") })
private Parent parent; private Parent parent;
@Column(name = "child_number")
private Integer number; private Integer number;
IncorrectChildId() { IncorrectChildId() {

View File

@ -18,6 +18,7 @@ import javax.persistence.Id;
import javax.persistence.Inheritance; import javax.persistence.Inheritance;
import javax.persistence.InheritanceType; import javax.persistence.InheritanceType;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
@ -148,6 +149,7 @@ public class DiscriminatorJoinedInheritanceTest extends BaseEnversJPAFunctionalT
} }
@Entity(name = "ChildListHolder") @Entity(name = "ChildListHolder")
@Table(name = "CHILD_HOLDER")
@Audited @Audited
public static class ChildListHolder { public static class ChildListHolder {
@Id @Id

View File

@ -14,6 +14,7 @@ import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.Priority;
@ -146,6 +147,7 @@ public class HasChangedBidirectionalTest extends AbstractModifiedFlagsEntityTest
} }
@Entity(name = "Comment") @Entity(name = "Comment")
@Table(name = "COMMENTS")
@Audited(withModifiedFlag = true) @Audited(withModifiedFlag = true)
public static class Comment { public static class Comment {
@Id @Id

View File

@ -21,10 +21,14 @@ import javax.persistence.OneToMany;
import javax.persistence.OrderColumn; import javax.persistence.OrderColumn;
import javax.persistence.Query; import javax.persistence.Query;
import org.hibernate.Session;
import org.hibernate.envers.AuditMappedBy; import org.hibernate.envers.AuditMappedBy;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority; import org.hibernate.envers.test.Priority;
import org.hibernate.type.IntegerType;
import org.hibernate.type.Type;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
@ -83,8 +87,11 @@ public class GroupMemberTest extends BaseEnversJPAFunctionalTestCase {
private Integer getCurrentAuditUniqueGroupId() { private Integer getCurrentAuditUniqueGroupId() {
return TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> { return TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
final Query query = entityManager.createNativeQuery( final Session session = entityManager.unwrap( Session.class );
"SELECT uniqueGroup_id FROM GroupMember_AUD ORDER BY rev DESC" final Query query = session.createSQLQuery(
"SELECT uniqueGroup_id FROM GroupMember_AUD ORDER BY rev DESC" ).addScalar(
"uniqueGroup_id",
IntegerType.INSTANCE
).setMaxResults( 1 ); ).setMaxResults( 1 );
final Object result = query.getSingleResult(); final Object result = query.getSingleResult();
assertNotNull( result ); assertNotNull( result );

View File

@ -38,7 +38,7 @@ public class MonotonicRevisionNumberTest extends BaseEnversFunctionalTestCase {
OrderedSequenceGenerator seqGenerator = (OrderedSequenceGenerator) generator; OrderedSequenceGenerator seqGenerator = (OrderedSequenceGenerator) generator;
Assert.assertTrue( Assert.assertTrue(
"Oracle sequence needs to be ordered in RAC environment.", "Oracle sequence needs to be ordered in RAC environment.",
seqGenerator.sqlCreateStrings( getDialect() )[0].endsWith( " order" ) seqGenerator.sqlCreateStrings( getDialect() )[0].toLowerCase().endsWith( " order" )
); );
} }
} }

View File

@ -187,7 +187,7 @@ public class SelectBeforeUpdateTest extends BaseEnversFunctionalTestCase {
} }
} }
@Entity @Entity(name = "Author")
@Audited @Audited
public static class Author { public static class Author {
@Id @Id

View File

@ -13,6 +13,7 @@ import javax.persistence.ElementCollection;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version; import javax.persistence.Version;
import org.hibernate.Session; import org.hibernate.Session;
@ -173,6 +174,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "ReadWriteCacheableItem") @Entity(name = "ReadWriteCacheableItem")
@Table(name = "RW_ITEM")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item")
public static class ReadWriteCacheableItem { public static class ReadWriteCacheableItem {
@ -215,6 +217,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "ReadWriteVersionedCacheableItem") @Entity(name = "ReadWriteVersionedCacheableItem")
@Table(name = "RW_VERSIONED_ITEM")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "item")
public static class ReadWriteVersionedCacheableItem { public static class ReadWriteVersionedCacheableItem {
@ -260,6 +263,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "NonStrictReadWriteCacheableItem") @Entity(name = "NonStrictReadWriteCacheableItem")
@Table(name = "RW_NOSTRICT_ITEM")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item")
public static class NonStrictReadWriteCacheableItem { public static class NonStrictReadWriteCacheableItem {
@ -302,6 +306,7 @@ public class RefreshUpdatedDataTest extends BaseNonConfigCoreFunctionalTestCase
} }
@Entity(name = "NonStrictReadWriteVersionedCacheableItem") @Entity(name = "NonStrictReadWriteVersionedCacheableItem")
@Table(name = "RW_NOSTRICT_VER_ITEM")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "item")
public static class NonStrictReadWriteVersionedCacheableItem { public static class NonStrictReadWriteVersionedCacheableItem {

View File

@ -96,7 +96,6 @@ ext {
postgresql: 'org.postgresql:postgresql:9.4-1202-jdbc41', postgresql: 'org.postgresql:postgresql:9.4-1202-jdbc41',
mysql: 'mysql:mysql-connector-java:6.0.5', mysql: 'mysql:mysql-connector-java:6.0.5',
mariadb: 'org.mariadb.jdbc:mariadb-java-client:1.5.7', mariadb: 'org.mariadb.jdbc:mariadb-java-client:1.5.7',
oracle: 'com.oracle.jdbc:ojdbc7:12.1.0.2',
oracle: 'com.oracle.ojdbc:ojdbc7:12.1.0.2.0', oracle: 'com.oracle.ojdbc:ojdbc7:12.1.0.2.0',
mssql: 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8', mssql: 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8',