From d5cdd9fb5ece79b14019fab2cc555f5fed7a5586 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 13 May 2025 14:05:46 +0200 Subject: [PATCH 1/3] HHH-19457 : reproducer in 5.x vs 6.x --- .../org/hibernate/bugs/ORMUnitTestCase.java | 40 +++++++++-- .../bugs/entities/EntityChildOne.java | 23 +++++++ .../EntityChildTwoSameDiscriminator.java | 23 +++++++ .../hibernate/bugs/entities/EntityParent.java | 58 ++++++++++++++++ .../bugs/entities/EntityRelation.java | 38 ++++++++++ .../org/hibernate/bugs/ORMUnitTestCase.java | 69 +++++++++++++------ .../bugs/entities/EntityChildOne.java | 24 +++++++ .../EntityChildTwoSameDiscriminator.java | 24 +++++++ .../hibernate/bugs/entities/EntityParent.java | 58 ++++++++++++++++ .../bugs/entities/EntityRelation.java | 38 ++++++++++ 10 files changed, 371 insertions(+), 24 deletions(-) create mode 100644 orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java create mode 100644 orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java create mode 100644 orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityParent.java create mode 100644 orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityRelation.java create mode 100644 orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java create mode 100644 orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java create mode 100644 orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityParent.java create mode 100644 orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityRelation.java diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java index 66757be07..ca5b1a8d0 100644 --- a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java @@ -17,9 +17,14 @@ import org.hibernate.Session; import org.hibernate.Transaction; +import org.hibernate.bugs.entities.EntityChildTwoSameDiscriminator; +import org.hibernate.bugs.entities.EntityParent; +import org.hibernate.bugs.entities.EntityChildOne; +import org.hibernate.bugs.entities.EntityRelation; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Configuration; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.junit.Assert; import org.junit.Test; /** @@ -37,8 +42,12 @@ public class ORMUnitTestCase extends BaseCoreFunctionalTestCase { @Override protected Class[] getAnnotatedClasses() { return new Class[] { -// Foo.class, -// Bar.class + EntityChildTwoSameDiscriminator.class, + EntityParent.class, + EntityChildOne.class, + EntityRelation.class + // Foo.class, + // Bar.class }; } @@ -46,8 +55,8 @@ protected Class[] getAnnotatedClasses() { @Override protected String[] getMappings() { return new String[] { -// "Foo.hbm.xml", -// "Bar.hbm.xml" + // "Foo.hbm.xml", + // "Bar.hbm.xml" }; } // If those mappings reside somewhere other than resources/org/hibernate/test, change this. @@ -72,8 +81,31 @@ public void hhh123Test() throws Exception { // BaseCoreFunctionalTestCase automatically creates the SessionFactory and provides the Session. Session s = openSession(); Transaction tx = s.beginTransaction(); + + EntityRelation entityRelation = new EntityRelation(); + entityRelation.setId("idRelation1"); + s.save(entityRelation); + + EntityChildOne entityChildOne = new EntityChildOne(); + entityChildOne.setId("idChild1"); + entityChildOne.setName("nameChild1"); + entityChildOne.setIdRelation("idRelation1"); + s.save(entityChildOne); + + EntityChildTwoSameDiscriminator entityChildTwo = new EntityChildTwoSameDiscriminator(); + entityChildTwo.setId("idChild2"); + entityChildTwo.setChildTwoName("nameChild2"); + entityChildTwo.setIdRelation("idRelation1"); + s.save(entityChildTwo); // Do stuff... tx.commit(); s.close(); + + s = openSession(); + tx = s.beginTransaction(); + EntityRelation relation = s.get(EntityRelation.class, "idRelation1"); + Assert.assertEquals("must have 2 parents", 2, relation.getParents().size()); + tx.commit(); + s.close(); } } diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java new file mode 100644 index 000000000..0c415391e --- /dev/null +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java @@ -0,0 +1,23 @@ +package org.hibernate.bugs.entities; + +import javax.persistence.Column; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "CHILD") +@DiscriminatorValue("15") +public class EntityChildOne extends EntityParent { + + @Column(name = "name") + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java new file mode 100644 index 000000000..3c44a424e --- /dev/null +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java @@ -0,0 +1,23 @@ +package org.hibernate.bugs.entities; + +import javax.persistence.Column; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "CHILD") +@DiscriminatorValue("24") +public class EntityChildTwoSameDiscriminator extends EntityParent { + + @Column(name = "child_two_name") + private String childTwoName; + + public String getChildTwoName() { + return childTwoName; + } + + public void setChildTwoName(String childTwoName) { + this.childTwoName = childTwoName; + } +} diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityParent.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityParent.java new file mode 100644 index 000000000..274b4b05f --- /dev/null +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityParent.java @@ -0,0 +1,58 @@ + +package org.hibernate.bugs.entities; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.DiscriminatorColumn; +import javax.persistence.DiscriminatorType; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity(name = "PARENT") +@Table(name = "PARENT") +@Inheritance(strategy = InheritanceType.JOINED) +@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "DISCRIMINATOR") +public abstract class EntityParent implements Serializable { + + @Id + @Column(name = "id") + private String id; + + @Column(name = "id_relation") + private String idRelation; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "id_relation", referencedColumnName = "id", insertable = false, updatable = false) + private EntityRelation relation; + + public EntityRelation getRelation() { + return relation; + } + + public void setRelation(EntityRelation requisition) { + this.relation = requisition; + } + + public String getIdRelation() { + return idRelation; + } + + public void setIdRelation(String idRelation) { + this.idRelation = idRelation; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityRelation.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityRelation.java new file mode 100644 index 000000000..9aadcdc4b --- /dev/null +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityRelation.java @@ -0,0 +1,38 @@ + +package org.hibernate.bugs.entities; + +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity(name = "RELATION") +@Table(name = "RELATION") +public class EntityRelation { + @Id + @Column(name = "id") + private String id; + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "relation") + private List parents; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public List getParents() { + return parents; + } + + public void setParents(List demandes) { + this.parents = demandes; + } +} diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java index eefb7df4c..5061e28b4 100644 --- a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java @@ -15,6 +15,10 @@ */ package org.hibernate.bugs; +import org.hibernate.bugs.entities.EntityChildOne; +import org.hibernate.bugs.entities.EntityChildTwoSameDiscriminator; +import org.hibernate.bugs.entities.EntityParent; +import org.hibernate.bugs.entities.EntityRelation; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.orm.junit.DomainModel; @@ -22,6 +26,7 @@ import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.Setting; +import org.junit.Assert; import org.junit.jupiter.api.Test; /** @@ -34,28 +39,31 @@ * submit it as a PR! */ @DomainModel( - annotatedClasses = { - // Add your entities here. - // Foo.class, - // Bar.class - }, - // If you use *.hbm.xml mappings, instead of annotations, add the mappings here. - xmlMappings = { - // "org/hibernate/test/Foo.hbm.xml", - // "org/hibernate/test/Bar.hbm.xml" - } + annotatedClasses = { + // Add your entities here. + EntityChildTwoSameDiscriminator.class, + EntityParent.class, + EntityChildOne.class, + EntityRelation.class + // Bar.class + }, + // If you use *.hbm.xml mappings, instead of annotations, add the mappings here. + xmlMappings = { + // "org/hibernate/test/Foo.hbm.xml", + // "org/hibernate/test/Bar.hbm.xml" + } ) @ServiceRegistry( - // Add in any settings that are specific to your test. See resources/hibernate.properties for the defaults. - settings = { - // For your own convenience to see generated queries: - @Setting(name = AvailableSettings.SHOW_SQL, value = "true"), - @Setting(name = AvailableSettings.FORMAT_SQL, value = "true"), - // @Setting( name = AvailableSettings.GENERATE_STATISTICS, value = "true" ), + // Add in any settings that are specific to your test. See resources/hibernate.properties for the defaults. + settings = { + // For your own convenience to see generated queries: + @Setting(name = AvailableSettings.SHOW_SQL, value = "true"), + @Setting(name = AvailableSettings.FORMAT_SQL, value = "true"), + // @Setting( name = AvailableSettings.GENERATE_STATISTICS, value = "true" ), - // Add your own settings that are a part of your quarkus configuration: - // @Setting( name = AvailableSettings.SOME_CONFIGURATION_PROPERTY, value = "SOME_VALUE" ), - } + // Add your own settings that are a part of your quarkus configuration: + // @Setting( name = AvailableSettings.SOME_CONFIGURATION_PROPERTY, value = "SOME_VALUE" ), + } ) @SessionFactory class ORMUnitTestCase { @@ -63,8 +71,29 @@ class ORMUnitTestCase { // Add your tests, using standard JUnit 5. @Test void hhh123Test(SessionFactoryScope scope) throws Exception { - scope.inTransaction( session -> { + scope.inTransaction( s -> { // Do stuff... + EntityRelation entityRelation = new EntityRelation(); + entityRelation.setId("idRelation1"); + s.save(entityRelation); + + EntityChildOne entityChildOne = new EntityChildOne(); + entityChildOne.setId("idChild1"); + entityChildOne.setName("nameChild1"); + entityChildOne.setIdRelation("idRelation1"); + s.save(entityChildOne); + + EntityChildTwoSameDiscriminator entityChildTwo = new EntityChildTwoSameDiscriminator(); + entityChildTwo.setId("idChild2"); + entityChildTwo.setChildTwoName("nameChild2"); + entityChildTwo.setIdRelation("idRelation1"); + s.save(entityChildTwo); } ); + + scope.inSession(s -> { + EntityRelation relation = s.get(EntityRelation.class, "idRelation1"); + // If you disable the -ea flag, the assertion will fail. + Assert.assertEquals("must have 2 parents", 2, relation.getParents().size()); + }); } } diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java new file mode 100644 index 000000000..83bb81e08 --- /dev/null +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildOne.java @@ -0,0 +1,24 @@ + +package org.hibernate.bugs.entities; + +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + +@Entity +@Table(name = "CHILD") +@DiscriminatorValue("15") +public class EntityChildOne extends EntityParent { + + @Column(name = "name") + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java new file mode 100644 index 000000000..e743f09aa --- /dev/null +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java @@ -0,0 +1,24 @@ + +package org.hibernate.bugs.entities; + +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + +@Entity +@Table(name = "CHILD") +@DiscriminatorValue("24") +public class EntityChildTwoSameDiscriminator extends EntityParent { + + @Column(name = "child_two_name") + private String childTwoName; + + public String getChildTwoName() { + return childTwoName; + } + + public void setChildTwoName(String childTwoName) { + this.childTwoName = childTwoName; + } +} diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityParent.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityParent.java new file mode 100644 index 000000000..c55f92421 --- /dev/null +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityParent.java @@ -0,0 +1,58 @@ + +package org.hibernate.bugs.entities; + +import java.io.Serializable; + +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorColumn; +import jakarta.persistence.DiscriminatorType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + +@Entity(name = "PARENT") +@Table(name = "PARENT") +@Inheritance(strategy = InheritanceType.JOINED) +@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "CODTYPDEM") +public abstract class EntityParent implements Serializable { + + @Id + @Column(name = "id") + private String id; + + @Column(name = "id_relation") + private String idRelation; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "id_relation", referencedColumnName = "id", insertable = false, updatable = false) + private EntityRelation relation; + + public EntityRelation getRelation() { + return relation; + } + + public void setRelation(EntityRelation requisition) { + this.relation = requisition; + } + + public String getIdRelation() { + return idRelation; + } + + public void setIdRelation(String idRelation) { + this.idRelation = idRelation; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityRelation.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityRelation.java new file mode 100644 index 000000000..1b38c6314 --- /dev/null +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityRelation.java @@ -0,0 +1,38 @@ + +package org.hibernate.bugs.entities; + +import java.util.List; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + +@Entity(name = "RELATION") +@Table(name = "RELATION") +public class EntityRelation { + @Id + @Column(name = "id") + private String id; + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "relation") + private List parents; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public List getParents() { + return parents; + } + + public void setParents(List demandes) { + this.parents = demandes; + } +} From f1cc0be0986a869916c4f9289d18cfeffa11b891 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 13 May 2025 14:18:11 +0200 Subject: [PATCH 2/3] Change testcase name to the correct jira identifier --- .../src/test/java/org/hibernate/bugs/ORMUnitTestCase.java | 2 +- .../src/test/java/org/hibernate/bugs/ORMUnitTestCase.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java index ca5b1a8d0..356dfabcb 100644 --- a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java @@ -77,7 +77,7 @@ protected void configure(Configuration configuration) { // Add your tests, using standard JUnit. @Test - public void hhh123Test() throws Exception { + public void hhh19457Test() throws Exception { // BaseCoreFunctionalTestCase automatically creates the SessionFactory and provides the Session. Session s = openSession(); Transaction tx = s.beginTransaction(); diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java index 5061e28b4..f988b955d 100644 --- a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java @@ -70,7 +70,7 @@ class ORMUnitTestCase { // Add your tests, using standard JUnit 5. @Test - void hhh123Test(SessionFactoryScope scope) throws Exception { + void hhh19457Test(SessionFactoryScope scope) throws Exception { scope.inTransaction( s -> { // Do stuff... EntityRelation entityRelation = new EntityRelation(); From 6001d41899c8a6d58d2f754b535d87540451de7c Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 13 May 2025 14:26:33 +0200 Subject: [PATCH 3/3] polish --- .../src/test/java/org/hibernate/bugs/ORMUnitTestCase.java | 6 +++--- ...oSameDiscriminator.java => EntityChildTwoSameTable.java} | 2 +- .../src/test/java/org/hibernate/bugs/ORMUnitTestCase.java | 6 +++--- ...oSameDiscriminator.java => EntityChildTwoSameTable.java} | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) rename orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/{EntityChildTwoSameDiscriminator.java => EntityChildTwoSameTable.java} (87%) rename orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/{EntityChildTwoSameDiscriminator.java => EntityChildTwoSameTable.java} (88%) diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java index 356dfabcb..9368c78f6 100644 --- a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java @@ -17,7 +17,7 @@ import org.hibernate.Session; import org.hibernate.Transaction; -import org.hibernate.bugs.entities.EntityChildTwoSameDiscriminator; +import org.hibernate.bugs.entities.EntityChildTwoSameTable; import org.hibernate.bugs.entities.EntityParent; import org.hibernate.bugs.entities.EntityChildOne; import org.hibernate.bugs.entities.EntityRelation; @@ -42,7 +42,7 @@ public class ORMUnitTestCase extends BaseCoreFunctionalTestCase { @Override protected Class[] getAnnotatedClasses() { return new Class[] { - EntityChildTwoSameDiscriminator.class, + EntityChildTwoSameTable.class, EntityParent.class, EntityChildOne.class, EntityRelation.class @@ -92,7 +92,7 @@ public void hhh19457Test() throws Exception { entityChildOne.setIdRelation("idRelation1"); s.save(entityChildOne); - EntityChildTwoSameDiscriminator entityChildTwo = new EntityChildTwoSameDiscriminator(); + EntityChildTwoSameTable entityChildTwo = new EntityChildTwoSameTable(); entityChildTwo.setId("idChild2"); entityChildTwo.setChildTwoName("nameChild2"); entityChildTwo.setIdRelation("idRelation1"); diff --git a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameTable.java similarity index 87% rename from orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java rename to orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameTable.java index 3c44a424e..f6d7dfcc8 100644 --- a/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java +++ b/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameTable.java @@ -8,7 +8,7 @@ @Entity @Table(name = "CHILD") @DiscriminatorValue("24") -public class EntityChildTwoSameDiscriminator extends EntityParent { +public class EntityChildTwoSameTable extends EntityParent { @Column(name = "child_two_name") private String childTwoName; diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java index f988b955d..fce275962 100644 --- a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java @@ -16,7 +16,7 @@ package org.hibernate.bugs; import org.hibernate.bugs.entities.EntityChildOne; -import org.hibernate.bugs.entities.EntityChildTwoSameDiscriminator; +import org.hibernate.bugs.entities.EntityChildTwoSameTable; import org.hibernate.bugs.entities.EntityParent; import org.hibernate.bugs.entities.EntityRelation; import org.hibernate.cfg.AvailableSettings; @@ -41,7 +41,7 @@ @DomainModel( annotatedClasses = { // Add your entities here. - EntityChildTwoSameDiscriminator.class, + EntityChildTwoSameTable.class, EntityParent.class, EntityChildOne.class, EntityRelation.class @@ -83,7 +83,7 @@ void hhh19457Test(SessionFactoryScope scope) throws Exception { entityChildOne.setIdRelation("idRelation1"); s.save(entityChildOne); - EntityChildTwoSameDiscriminator entityChildTwo = new EntityChildTwoSameDiscriminator(); + EntityChildTwoSameTable entityChildTwo = new EntityChildTwoSameTable(); entityChildTwo.setId("idChild2"); entityChildTwo.setChildTwoName("nameChild2"); entityChildTwo.setIdRelation("idRelation1"); diff --git a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameTable.java similarity index 88% rename from orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java rename to orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameTable.java index e743f09aa..5f99c333b 100644 --- a/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameDiscriminator.java +++ b/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/entities/EntityChildTwoSameTable.java @@ -9,7 +9,7 @@ @Entity @Table(name = "CHILD") @DiscriminatorValue("24") -public class EntityChildTwoSameDiscriminator extends EntityParent { +public class EntityChildTwoSameTable extends EntityParent { @Column(name = "child_two_name") private String childTwoName;