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 82f45fc741
commit 5c2fb290f5
1 changed files with 16 additions and 17 deletions

View File

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