HHH-17871 Error if defining a ManyToAny in the child classes which references a @MappedSuperclass

Rename column "ROLE" to "ROLE_COL" for a problem with sybase
This commit is contained in:
Vincent Bouthinon 2024-03-21 11:32:02 +01:00 committed by Christian Beikov
parent fdd3ded888
commit 915c8b8ead
1 changed files with 16 additions and 17 deletions

View File

@ -1,12 +1,18 @@
package org.hibernate.orm.test.associations.any; package org.hibernate.orm.test.associations.any;
import static jakarta.persistence.InheritanceType.SINGLE_TABLE;
import static org.hibernate.annotations.CascadeType.ALL;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.hibernate.Hibernate;
import org.hibernate.annotations.AnyKeyJavaClass;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.ManyToAny;
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.Jpa;
import org.junit.jupiter.api.Test;
import jakarta.persistence.Access; import jakarta.persistence.Access;
import jakarta.persistence.AccessType; import jakarta.persistence.AccessType;
import jakarta.persistence.Column; import jakarta.persistence.Column;
@ -22,16 +28,9 @@ import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import jakarta.persistence.Transient; import jakarta.persistence.Transient;
import org.hibernate.Hibernate; import static jakarta.persistence.InheritanceType.SINGLE_TABLE;
import org.hibernate.annotations.AnyKeyJavaClass; import static org.hibernate.annotations.CascadeType.ALL;
import org.hibernate.annotations.Cascade; import static org.junit.jupiter.api.Assertions.assertTrue;
import org.hibernate.annotations.ManyToAny;
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.Jpa;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@Jpa( @Jpa(
annotatedClasses = { annotatedClasses = {
@ -60,7 +59,7 @@ class ManyToAnySubClassAccessPropertyTest {
@Entity @Entity
@Inheritance(strategy = SINGLE_TABLE) @Inheritance(strategy = SINGLE_TABLE)
@DiscriminatorColumn(name = "ROLE", length = 100) @DiscriminatorColumn(name = "ROLE_COL", length = 100)
@Table(name = "TANIMAL") @Table(name = "TANIMAL")
public static class Animal { public static class Animal {
@ -88,7 +87,7 @@ class ManyToAnySubClassAccessPropertyTest {
@ManyToAny @ManyToAny
@AnyKeyJavaClass(Integer.class) @AnyKeyJavaClass(Integer.class)
@Cascade(ALL) @Cascade(ALL)
@Column(name = "ROLE") @Column(name = "ROLE_COL")
@JoinTable(name = "DOG_OWNER", joinColumns = @JoinColumn(name = "SOURCE"), inverseJoinColumns = @JoinColumn(name = "DEST")) @JoinTable(name = "DOG_OWNER", joinColumns = @JoinColumn(name = "SOURCE"), inverseJoinColumns = @JoinColumn(name = "DEST"))
@Override @Override
public Set<Person> getOwners() { public Set<Person> getOwners() {
@ -104,7 +103,7 @@ class ManyToAnySubClassAccessPropertyTest {
@ManyToAny @ManyToAny
@AnyKeyJavaClass(Integer.class) @AnyKeyJavaClass(Integer.class)
@Cascade(ALL) @Cascade(ALL)
@Column(name = "ROLE") @Column(name = "ROLE_COL")
@JoinTable(name = "DOG_OWNER", joinColumns = @JoinColumn(name = "SOURCE"), inverseJoinColumns = @JoinColumn(name = "DEST")) @JoinTable(name = "DOG_OWNER", joinColumns = @JoinColumn(name = "SOURCE"), inverseJoinColumns = @JoinColumn(name = "DEST"))
@Override @Override
public Set<Person> getOwners() { public Set<Person> getOwners() {