From d213fff3de94ce78788db742134c614b8bd40da4 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Thu, 27 Jul 2023 18:28:35 +0200 Subject: [PATCH] Make sure tests work with Oracle 11 --- .../idclass/IdClassWithSuperclassTest.java | 2 +- .../ExtendedEnhancementNonStandardAccessTest.java | 11 ++++++++--- .../cache/ManyToOneTestReusedColumn.java | 14 +++++++------- .../lazy/LazyAbstractManyToOneNoProxyTest.java | 8 +++++--- .../enhancement/lazy/LazyManyToOneNoProxyTest.java | 6 ++++-- .../EmbeddableWithParentWithInheritance2Test.java | 4 +--- .../EmbeddableWithParentWithInheritanceTest.java | 3 +-- .../hibernate/orm/test/foreignkeys/sorting/A.java | 3 +-- .../jpa/criteria/SelectOnlyArrayPropertyTest.java | 2 +- .../manytoone/EntityWithEagerManyToOneTest.java | 3 +++ .../manytoone/EntityWithLazyManyToOneTest.java | 3 +++ 11 files changed, 35 insertions(+), 24 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/idclass/IdClassWithSuperclassTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/idclass/IdClassWithSuperclassTest.java index 0180fc1929..7d17085852 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/idclass/IdClassWithSuperclassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/idclass/IdClassWithSuperclassTest.java @@ -61,7 +61,7 @@ public class IdClassWithSuperclassTest { } } - @Entity + @Entity(name = "MyEntity") @IdClass(ChildPrimaryKey.class) public static class MyEntity { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/basic/ExtendedEnhancementNonStandardAccessTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/basic/ExtendedEnhancementNonStandardAccessTest.java index c9ab86b112..fa83abd512 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/basic/ExtendedEnhancementNonStandardAccessTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/basic/ExtendedEnhancementNonStandardAccessTest.java @@ -10,6 +10,7 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; import org.junit.runner.RunWith; +import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; @@ -508,11 +509,11 @@ public class ExtendedEnhancementNonStandardAccessTest extends BaseCoreFunctional @Id @GeneratedValue public long id; - + @Column(name = "abstract_public_field") public Long abstractEntityPublicField; - + @Column(name = "abstract_protected_field") protected Long abstractEntityProtectedField; - + @Column(name = "abstract_default_field") Long abstractEntityPackagePrivateField; } @@ -523,9 +524,13 @@ public class ExtendedEnhancementNonStandardAccessTest extends BaseCoreFunctional @Entity(name = "concrete") public static class MyConcreteEntity extends MyAbstractConfusingEntity { + @Column(name = "concrete_public_field") public Long publicField; + @Column(name = "concrete_protected_field") protected Long protectedField; + @Column(name = "concrete_default_field") Long packagePrivateField; + @Column(name = "concrete_private_field") private Long privateField; public Long getAbstractEntityPublicField() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/cache/ManyToOneTestReusedColumn.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/cache/ManyToOneTestReusedColumn.java index af2b051249..d834cf38d0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/cache/ManyToOneTestReusedColumn.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/cache/ManyToOneTestReusedColumn.java @@ -112,7 +112,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { ); } - @Entity + @Entity(name = "Fridge") @Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public static class Fridge { @@ -145,7 +145,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "Container") @BatchSize(size = 500) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Cacheable @@ -177,7 +177,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "FruitContainer") @DiscriminatorValue(value = "FRUIT_CONTAINER") public static class FruitContainer extends Container { @ManyToOne @@ -194,7 +194,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "CheeseContainer") @DiscriminatorValue(value = "CHEESE_CONTAINER") public static class CheeseContainer extends Container { @ManyToOne @@ -211,7 +211,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "Food") @BatchSize(size = 500) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Cacheable @@ -232,7 +232,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "Fruit") @BatchSize(size = 500) @DiscriminatorValue(value = "FRUIT") public static class Fruit extends Food { @@ -249,7 +249,7 @@ public class ManyToOneTestReusedColumn extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "Cheese") @BatchSize(size = 500) @DiscriminatorValue(value = "CHEESE") public static class Cheese extends Food { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyAbstractManyToOneNoProxyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyAbstractManyToOneNoProxyTest.java index c86eb5469c..8fa049c592 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyAbstractManyToOneNoProxyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyAbstractManyToOneNoProxyTest.java @@ -20,6 +20,7 @@ import jakarta.persistence.Inheritance; import jakarta.persistence.InheritanceType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @@ -95,7 +96,8 @@ public class LazyAbstractManyToOneNoProxyTest extends BaseCoreFunctionalTestCase ); } - @Entity + @Entity(name = "User") + @Table(name = "usr_tbl") @Proxy(lazy = false) public static class User { @Id @@ -129,7 +131,7 @@ public class LazyAbstractManyToOneNoProxyTest extends BaseCoreFunctionalTestCase } } - @Entity + @Entity(name = "ActorGroup") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "TYPE") @Proxy(lazy = false) @@ -145,7 +147,7 @@ public class LazyAbstractManyToOneNoProxyTest extends BaseCoreFunctionalTestCase } } - @Entity + @Entity(name = "UserGroup") @Proxy(lazy = false) @DiscriminatorValue("USERS") public static class UserGroup extends ActorGroup { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyManyToOneNoProxyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyManyToOneNoProxyTest.java index d674e1ff1c..de72941eee 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyManyToOneNoProxyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/LazyManyToOneNoProxyTest.java @@ -16,6 +16,7 @@ import jakarta.persistence.FetchType; import jakarta.persistence.Id; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @@ -88,7 +89,8 @@ public class LazyManyToOneNoProxyTest extends BaseCoreFunctionalTestCase { ); } - @Entity + @Entity(name = "User") + @Table(name = "usr_tbl") @Proxy(lazy = false) public static class User { @Id @@ -122,7 +124,7 @@ public class LazyManyToOneNoProxyTest extends BaseCoreFunctionalTestCase { } } - @Entity + @Entity(name = "UserGroup") @Proxy(lazy = false) public static class UserGroup { @Id diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritance2Test.java b/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritance2Test.java index d45dbe7ac9..cd7a895449 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritance2Test.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritance2Test.java @@ -1,7 +1,6 @@ package org.hibernate.orm.test.embeddable; import org.hibernate.Hibernate; -import org.hibernate.annotations.BatchSize; import org.hibernate.annotations.Parent; import org.hibernate.testing.orm.junit.DomainModel; @@ -17,7 +16,6 @@ import jakarta.persistence.Embeddable; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.Inheritance; import jakarta.persistence.InheritanceType; @@ -81,7 +79,7 @@ public class EmbeddableWithParentWithInheritance2Test { } @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue public Long getId() { return id; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritanceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritanceTest.java index 099845fdd7..5a9d6a98c9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritanceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/embeddable/EmbeddableWithParentWithInheritanceTest.java @@ -17,7 +17,6 @@ import jakarta.persistence.Embeddable; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.Inheritance; import jakarta.persistence.InheritanceType; @@ -80,7 +79,7 @@ public class EmbeddableWithParentWithInheritanceTest { } @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue public Long getId() { return id; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/foreignkeys/sorting/A.java b/hibernate-core/src/test/java/org/hibernate/orm/test/foreignkeys/sorting/A.java index 1e26aee586..6d16596f0f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/foreignkeys/sorting/A.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/foreignkeys/sorting/A.java @@ -9,7 +9,6 @@ package org.hibernate.orm.test.foreignkeys.sorting; import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; @@ -19,7 +18,7 @@ import jakarta.persistence.ManyToOne; @Entity public class A { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue private int id; @ManyToOne(cascade = CascadeType.PERSIST) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/SelectOnlyArrayPropertyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/SelectOnlyArrayPropertyTest.java index 49b17d1222..bb41ead74f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/SelectOnlyArrayPropertyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/SelectOnlyArrayPropertyTest.java @@ -78,7 +78,7 @@ public class SelectOnlyArrayPropertyTest extends BaseEntityManagerFunctionalTest } ); } - @Entity + @Entity(name = "EntityWithIdAndIntegerArray") public static class EntityWithIdAndIntegerArray { @Id diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithEagerManyToOneTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithEagerManyToOneTest.java index 5749285daf..ef1db9bac8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithEagerManyToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithEagerManyToOneTest.java @@ -22,6 +22,7 @@ import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import static org.assertj.core.api.Assertions.assertThat; @@ -135,6 +136,7 @@ public class EntityWithEagerManyToOneTest { } @Entity(name = "LazyAbstractEntityReference") + @Table(name = "lazy_abstract_ent_ref") @Cacheable public static class LazyAbstractEntityReference { @@ -170,6 +172,7 @@ public class EntityWithEagerManyToOneTest { } @Entity(name = "LazyConcreteEntityReference") + @Table(name = "lazy_concrete_ent_ref") @Cacheable public static class LazyConcreteEntityReference { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithLazyManyToOneTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithLazyManyToOneTest.java index fe4c628743..298541fd3d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithLazyManyToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/manytoone/EntityWithLazyManyToOneTest.java @@ -25,6 +25,7 @@ import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; @DomainModel( annotatedClasses = { @@ -137,6 +138,7 @@ public class EntityWithLazyManyToOneTest { } @Entity(name = "LazyAbstractEntityReference") + @Table(name = "lazy_abstract_ent_ref") @Cacheable public static class LazyAbstractEntityReference { @@ -172,6 +174,7 @@ public class EntityWithLazyManyToOneTest { } @Entity(name = "LazyConcreteEntityReference") + @Table(name = "lazy_concrete_ent_ref") @Cacheable public static class LazyConcreteEntityReference {