Make sure tests work with Oracle 11

This commit is contained in:
Christian Beikov 2023-07-27 18:28:35 +02:00
parent c5cd1c2664
commit d213fff3de
11 changed files with 35 additions and 24 deletions

View File

@ -61,7 +61,7 @@ public ChildPrimaryKey(Integer parentId, Integer childId) {
}
}
@Entity
@Entity(name = "MyEntity")
@IdClass(ChildPrimaryKey.class)
public static class MyEntity {

View File

@ -10,6 +10,7 @@
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 static abstract class MyAbstractEntity {
@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 static abstract class MyAbstractConfusingEntity extends MyAbstractEntity
@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() {

View File

@ -112,7 +112,7 @@ else if ( container instanceof CheeseContainer ) {
);
}
@Entity
@Entity(name = "Fridge")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public static class Fridge {
@ -145,7 +145,7 @@ public void addToFridge(Container container) {
}
}
@Entity
@Entity(name = "Container")
@BatchSize(size = 500)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Cacheable
@ -177,7 +177,7 @@ public void setFridge(Fridge fridge) {
}
}
@Entity
@Entity(name = "FruitContainer")
@DiscriminatorValue(value = "FRUIT_CONTAINER")
public static class FruitContainer extends Container {
@ManyToOne
@ -194,7 +194,7 @@ public void setFruit(Fruit fruit) {
}
}
@Entity
@Entity(name = "CheeseContainer")
@DiscriminatorValue(value = "CHEESE_CONTAINER")
public static class CheeseContainer extends Container {
@ManyToOne
@ -211,7 +211,7 @@ public void setCheese(Cheese cheese) {
}
}
@Entity
@Entity(name = "Food")
@BatchSize(size = 500)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Cacheable
@ -232,7 +232,7 @@ public void setId(Long id) {
}
}
@Entity
@Entity(name = "Fruit")
@BatchSize(size = 500)
@DiscriminatorValue(value = "FRUIT")
public static class Fruit extends Food {
@ -249,7 +249,7 @@ public void setBestPairedWith(Fruit bestPairedWith) {
}
}
@Entity
@Entity(name = "Cheese")
@BatchSize(size = 500)
@DiscriminatorValue(value = "CHEESE")
public static class Cheese extends Food {

View File

@ -20,6 +20,7 @@
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 void testSelect() {
);
}
@Entity
@Entity(name = "User")
@Table(name = "usr_tbl")
@Proxy(lazy = false)
public static class User {
@Id
@ -129,7 +131,7 @@ public ActorGroup getTeam() {
}
}
@Entity
@Entity(name = "ActorGroup")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE")
@Proxy(lazy = false)
@ -145,7 +147,7 @@ public ActorGroup(Long id) {
}
}
@Entity
@Entity(name = "UserGroup")
@Proxy(lazy = false)
@DiscriminatorValue("USERS")
public static class UserGroup extends ActorGroup {

View File

@ -16,6 +16,7 @@
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 void testSelect() {
);
}
@Entity
@Entity(name = "User")
@Table(name = "usr_tbl")
@Proxy(lazy = false)
public static class User {
@Id
@ -122,7 +124,7 @@ public UserGroup getTeam() {
}
}
@Entity
@Entity(name = "UserGroup")
@Proxy(lazy = false)
public static class UserGroup {
@Id

View File

@ -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.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 String describe() {
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue
public Long getId() {
return id;
}

View File

@ -17,7 +17,6 @@
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 String describe() {
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue
public Long getId() {
return id;
}

View File

@ -9,7 +9,6 @@
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 @@
@Entity
public class A {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue
private int id;
@ManyToOne(cascade = CascadeType.PERSIST)

View File

@ -78,7 +78,7 @@ public void criteriaSelectWrappedIntArray() {
} );
}
@Entity
@Entity(name = "EntityWithIdAndIntegerArray")
public static class EntityWithIdAndIntegerArray {
@Id

View File

@ -22,6 +22,7 @@
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 void setContent(String content) {
}
@Entity(name = "LazyAbstractEntityReference")
@Table(name = "lazy_abstract_ent_ref")
@Cacheable
public static class LazyAbstractEntityReference {
@ -170,6 +172,7 @@ public void setEntity(AbstractEntity entity) {
}
@Entity(name = "LazyConcreteEntityReference")
@Table(name = "lazy_concrete_ent_ref")
@Cacheable
public static class LazyConcreteEntityReference {

View File

@ -25,6 +25,7 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@DomainModel(
annotatedClasses = {
@ -137,6 +138,7 @@ public void setContent(String content) {
}
@Entity(name = "LazyAbstractEntityReference")
@Table(name = "lazy_abstract_ent_ref")
@Cacheable
public static class LazyAbstractEntityReference {
@ -172,6 +174,7 @@ public void setEntity(AbstractEntity entity) {
}
@Entity(name = "LazyConcreteEntityReference")
@Table(name = "lazy_concrete_ent_ref")
@Cacheable
public static class LazyConcreteEntityReference {