HHH-11536 - Fix unit tests failing on Oracle
This commit is contained in:
parent
2a32c8ff0d
commit
e54ce7b266
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.jpa.test.criteria.components;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Embedded;
|
||||
|
@ -304,6 +305,7 @@ public class ComponentInWhereClauseTest extends BaseEntityManagerFunctionalTestC
|
|||
|
||||
@Embeddable
|
||||
public static class Phone {
|
||||
@Column(name = "phone_number")
|
||||
private String number;
|
||||
|
||||
public Phone() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Embedded;
|
||||
|
@ -237,6 +238,7 @@ public class EntitySuperclassComponentWithCollectionTest extends BaseEntityManag
|
|||
|
||||
@Embeddable
|
||||
public static class Phone {
|
||||
@Column(name = "phone_number")
|
||||
private String number;
|
||||
|
||||
public Phone() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Embedded;
|
||||
|
@ -236,6 +237,7 @@ public class MappedSuperclassComponentWithCollectionTest extends BaseEntityManag
|
|||
|
||||
@Embeddable
|
||||
public static class Phone {
|
||||
@Column(name = "phone_number")
|
||||
private String number;
|
||||
|
||||
public Phone() {
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.hibernate.jpa.QueryHints;
|
|||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
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;
|
||||
|
@ -719,6 +720,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
|
|||
@Test
|
||||
@RequiresDialect( Oracle10gDialect.class )
|
||||
@RequiresDialectFeature( DialectChecks.SupportsLockTimeouts.class )
|
||||
@FailureExpected( jiraKey = "HHH-8001" )
|
||||
public void testQueryTimeout() throws Exception {
|
||||
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
|
@ -812,6 +814,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
|
|||
@Test
|
||||
@RequiresDialect( Oracle10gDialect.class )
|
||||
@RequiresDialectFeature( DialectChecks.SupportsLockTimeouts.class )
|
||||
@FailureExpected( jiraKey = "HHH-8001" )
|
||||
public void testQueryTimeoutEMProps() throws Exception {
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
Map<String, Object> queryTimeoutProps = new HashMap<String, Object>();
|
||||
|
|
|
@ -19,6 +19,8 @@ import javax.persistence.OneToOne;
|
|||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -28,6 +30,7 @@ import static org.junit.Assert.assertNull;
|
|||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class)
|
||||
public class NotFoundTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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.cascade.CascadeWithFkConstraintTestTask;
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.bytecode.enhancement.EnhancerTestContext;
|
||||
import org.hibernate.testing.bytecode.enhancement.EnhancerTestUtils;
|
||||
|
@ -131,6 +133,7 @@ public class EnhancerTest extends BaseUnitTestCase {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-11173" )
|
||||
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class)
|
||||
public void testLazyCache() {
|
||||
EnhancerTestUtils.runEnhancerTestTask( LazyInCacheTestTask.class );
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DetachedGetIdentifierTestTask extends AbstractEnhancerTestTask {
|
|||
protected void cleanup() {
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "SimpleEntity")
|
||||
public static class SimpleEntity {
|
||||
|
||||
@Id
|
||||
|
|
|
@ -66,7 +66,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask {
|
|||
protected void cleanup() {
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Order")
|
||||
@Cache( usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE )
|
||||
public static class Order {
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask {
|
|||
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Product")
|
||||
public static class Product {
|
||||
|
||||
@Id
|
||||
|
@ -98,7 +98,7 @@ public class LazyInCacheTestTask extends AbstractEnhancerTestTask {
|
|||
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Tag")
|
||||
public class Tag {
|
||||
|
||||
@Id
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.test.converter;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Convert;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -103,6 +104,7 @@ public class LongToDateConversionTest extends BaseCoreFunctionalTestCase {
|
|||
private long id;
|
||||
|
||||
@Convert(converter = DateAttributeConverter.class)
|
||||
@Column(name = "attribute_date")
|
||||
private DateAttribute date;
|
||||
|
||||
public DateAttribute getDate() {
|
||||
|
|
|
@ -83,7 +83,7 @@ public class NonTransactionalDataAccessTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test(expected = TransactionRequiredException.class)
|
||||
public void testFlushDisallowingutOfTransactionUpdateOperations() throws Exception {
|
||||
public void testFlushDisallowingOutOfTransactionUpdateOperations() throws Exception {
|
||||
allowUpdateOperationOutsideTransaction = "false";
|
||||
rebuildSessionFactory();
|
||||
prepareTest();
|
||||
|
@ -115,7 +115,7 @@ public class NonTransactionalDataAccessTest extends BaseCoreFunctionalTestCase {
|
|||
@Entity(name = "MyEntity")
|
||||
public static class MyEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GeneratedValue
|
||||
long id;
|
||||
|
||||
String name;
|
||||
|
|
|
@ -87,23 +87,21 @@ 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() );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupTest() throws Exception {
|
||||
try (Session session = openSession()) {
|
||||
session.doWork( connection -> {
|
||||
final Statement stmnt = connection.createStatement();
|
||||
|
||||
stmnt.execute( getDialect().getDropTableString( "SANDBOX_JDBC_TST" ) );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
private ResourceRegistry getResourceRegistry(JdbcCoordinator jdbcCoord) {
|
||||
return jdbcCoord.getResourceRegistry();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,11 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Lob;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.engine.jdbc.ClobProxy;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.hibernate.testing.transaction.TransactionUtil;
|
||||
|
@ -32,6 +34,7 @@ import static org.junit.Assert.fail;
|
|||
* @author Andrea Boriero
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-11477")
|
||||
@SkipForDialect(Oracle8iDialect.class)
|
||||
public class LobStringTest extends BaseCoreFunctionalTestCase {
|
||||
private static final int LONG_STRING_SIZE = 10000;
|
||||
|
||||
|
|
|
@ -10,9 +10,11 @@ import java.util.List;
|
|||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.hibernate.testing.transaction.TransactionUtil;
|
||||
|
@ -97,6 +99,7 @@ public abstract class LongStringTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SkipForDialect(Oracle8iDialect.class)
|
||||
@TestForIssue( jiraKey = "HHH-11477")
|
||||
public void testUsingLobPropertyInHqlQuery() {
|
||||
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
||||
|
@ -116,6 +119,7 @@ public abstract class LongStringTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SkipForDialect(Oracle8iDialect.class)
|
||||
@TestForIssue( jiraKey = "HHH-11477")
|
||||
public void testSelectLobPropertyInHqlQuery() {
|
||||
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
||||
|
|
|
@ -303,7 +303,6 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-10898")
|
||||
public void testNamedNativeQueryStoredProcedureRefCursor() {
|
||||
EntityManager entityManager = createEntityManager();
|
||||
entityManager.getTransaction().begin();
|
||||
|
|
|
@ -11,13 +11,12 @@ package org.hibernate.test.subquery;
|
|||
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.dialect.MariaDBDialect;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
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.type.Type;
|
||||
import org.junit.Test;
|
||||
|
@ -31,7 +30,7 @@ import java.util.function.Consumer;
|
|||
*
|
||||
* @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 {
|
||||
|
||||
private static final SQLFunction LIMIT_FUNCTION = new SQLFunction() {
|
||||
|
|
|
@ -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;
|
||||
|
@ -22,6 +23,7 @@ import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoo
|
|||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||
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;
|
||||
|
@ -89,12 +91,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,
|
||||
|
|
|
@ -13,6 +13,7 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.Id;
|
||||
|
||||
import org.hibernate.dialect.MariaDBDialect;
|
||||
import org.hibernate.dialect.Oracle9iDialect;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
@ -27,6 +28,7 @@ import static org.junit.Assert.assertEquals;
|
|||
*/
|
||||
@TestForIssue(jiraKey = "HHH-10465")
|
||||
@SkipForDialect(MariaDBDialect.class)
|
||||
@SkipForDialect(value = Oracle9iDialect.class, comment = "Oracle date does not support milliseconds ")
|
||||
public class TimeAndTimestampTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -15,11 +15,13 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.envers.test.tools.TestTools;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.transaction.TransactionUtil;
|
||||
import org.junit.Test;
|
||||
|
@ -30,6 +32,7 @@ import static org.junit.Assert.assertEquals;
|
|||
* @author Chris Cranford
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-9834")
|
||||
@SkipForDialect(Oracle8iDialect.class)
|
||||
public class StringMapLobTest extends BaseEnversJPAFunctionalTestCase {
|
||||
@Override
|
||||
protected Class<?>[] getAnnotatedClasses() {
|
||||
|
|
|
@ -16,11 +16,13 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Lob;
|
||||
|
||||
import org.hibernate.annotations.Nationalized;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.envers.test.tools.TestTools;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.transaction.TransactionUtil;
|
||||
import org.junit.Test;
|
||||
|
@ -31,6 +33,7 @@ import static org.junit.Assert.assertEquals;
|
|||
* @author Chris Cranford
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-9834")
|
||||
@SkipForDialect(Oracle8iDialect.class)
|
||||
public class StringMapNationalizedLobTest extends BaseEnversJPAFunctionalTestCase {
|
||||
@Override
|
||||
protected Class<?>[] getAnnotatedClasses() {
|
||||
|
|
|
@ -12,12 +12,14 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
|
@ -160,7 +162,7 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
return book;
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Author")
|
||||
@Audited
|
||||
public static class Author {
|
||||
@Id
|
||||
|
@ -171,8 +173,7 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
private String lastName;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "author_id", referencedColumnName = "id", nullable = false)
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "author")
|
||||
private List<Book> books;
|
||||
|
||||
public Integer getId() {
|
||||
|
@ -244,7 +245,7 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Book")
|
||||
@Audited
|
||||
public static class Book {
|
||||
@Id
|
||||
|
@ -254,7 +255,8 @@ public class ListHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
private String title;
|
||||
|
||||
@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
|
||||
private Author author;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import javax.persistence.FetchType;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
|
@ -161,7 +162,7 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
return book;
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Author")
|
||||
@Audited
|
||||
public static class Author {
|
||||
@Id
|
||||
|
@ -172,8 +173,7 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
private String lastName;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "author_id", referencedColumnName = "id", nullable = false)
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "author")
|
||||
private Set<Book> books;
|
||||
|
||||
public Integer getId() {
|
||||
|
@ -245,7 +245,7 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Book")
|
||||
@Audited
|
||||
public static class Book {
|
||||
@Id
|
||||
|
@ -255,7 +255,8 @@ public class SetHashcodeChangeTest extends BaseEnversJPAFunctionalTestCase {
|
|||
private String title;
|
||||
|
||||
@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
|
||||
private Author author;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ public class CorrectChildId implements Serializable {
|
|||
@Column(name = "parent_id")
|
||||
private String id;
|
||||
|
||||
@Column(name = "child_number")
|
||||
private Integer number;
|
||||
|
||||
CorrectChildId() {
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.envers.test.integration.ids.embeddedid;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinColumns;
|
||||
|
@ -22,6 +23,7 @@ public class IncorrectChildId implements Serializable {
|
|||
@JoinColumns({ @JoinColumn(name = "parent_id", referencedColumnName = "id") })
|
||||
private Parent parent;
|
||||
|
||||
@Column(name = "child_number")
|
||||
private Integer number;
|
||||
|
||||
IncorrectChildId() {
|
||||
|
|
|
@ -18,6 +18,7 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
|
@ -148,6 +149,7 @@ public class DiscriminatorJoinedInheritanceTest extends BaseEnversJPAFunctionalT
|
|||
}
|
||||
|
||||
@Entity(name = "ChildListHolder")
|
||||
@Table(name = "CHILD_HOLDER")
|
||||
@Audited
|
||||
public static class ChildListHolder {
|
||||
@Id
|
||||
|
|
|
@ -14,6 +14,7 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
|
@ -146,6 +147,7 @@ public class HasChangedBidirectionalTest extends AbstractModifiedFlagsEntityTest
|
|||
}
|
||||
|
||||
@Entity(name = "Comment")
|
||||
@Table(name = "COMMENTS")
|
||||
@Audited(withModifiedFlag = true)
|
||||
public static class Comment {
|
||||
@Id
|
||||
|
|
|
@ -21,10 +21,14 @@ import javax.persistence.OneToMany;
|
|||
import javax.persistence.OrderColumn;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.envers.AuditMappedBy;
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
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.transaction.TransactionUtil;
|
||||
import org.junit.Test;
|
||||
|
@ -83,8 +87,11 @@ public class GroupMemberTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
private Integer getCurrentAuditUniqueGroupId() {
|
||||
return TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
|
||||
final Query query = entityManager.createNativeQuery(
|
||||
"SELECT uniqueGroup_id FROM GroupMember_AUD ORDER BY rev DESC"
|
||||
final Session session = entityManager.unwrap( Session.class );
|
||||
final Query query = session.createSQLQuery(
|
||||
"SELECT uniqueGroup_id FROM GroupMember_AUD ORDER BY rev DESC" ).addScalar(
|
||||
"uniqueGroup_id",
|
||||
IntegerType.INSTANCE
|
||||
).setMaxResults( 1 );
|
||||
final Object result = query.getSingleResult();
|
||||
assertNotNull( result );
|
||||
|
|
|
@ -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" )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public class SelectBeforeUpdateTest extends BaseEnversFunctionalTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Entity(name = "Author")
|
||||
@Audited
|
||||
public static class Author {
|
||||
@Id
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ ext {
|
|||
postgresql: 'org.postgresql:postgresql:9.4-1202-jdbc41',
|
||||
mysql: 'mysql:mysql-connector-java:6.0.5',
|
||||
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',
|
||||
mssql: 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8',
|
||||
|
|
Loading…
Reference in New Issue