diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Animal.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Animal.java new file mode 100644 index 0000000000..6cf481293d --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Animal.java @@ -0,0 +1,16 @@ +package org.hibernate.orm.test.hbm.inheritance; + +public abstract class Animal { + + private long id; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/AnimalReport.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/AnimalReport.hbm.xml new file mode 100644 index 0000000000..ad6d7802c5 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/AnimalReport.hbm.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/AnimalReport.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/AnimalReport.java new file mode 100644 index 0000000000..5cf7edf959 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/AnimalReport.java @@ -0,0 +1,34 @@ +package org.hibernate.orm.test.hbm.inheritance; + +public class AnimalReport { + + private long id; + + private String name; + + private Animal animal; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Animal getAnimal() { + return animal; + } + + public void setAnimal(Animal animal) { + this.animal = animal; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Cat.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Cat.java new file mode 100644 index 0000000000..a6b91655d4 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Cat.java @@ -0,0 +1,14 @@ +package org.hibernate.orm.test.hbm.inheritance; + +public class Cat extends Animal { + + private CatName name; + + public CatName getName() { + return name; + } + + public void setName(CatName name) { + this.name = name; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/CatName.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/CatName.java new file mode 100644 index 0000000000..e65649bde0 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/CatName.java @@ -0,0 +1,24 @@ +package org.hibernate.orm.test.hbm.inheritance; + +public class CatName { + private long id; + + private String name; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Dog.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Dog.java new file mode 100644 index 0000000000..4a2907476f --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/Dog.java @@ -0,0 +1,14 @@ +package org.hibernate.orm.test.hbm.inheritance; + +public class Dog extends Animal { + + private DogName name; + + public DogName getName() { + return name; + } + + public void setName(DogName name) { + this.name = name; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/DogName.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/DogName.java new file mode 100644 index 0000000000..c1db365532 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/DogName.java @@ -0,0 +1,24 @@ +package org.hibernate.orm.test.hbm.inheritance; + +public class DogName { + private long id; + + private String name; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/JoinedSubclassesWithSameFieldNamesButDifferentTypesTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/JoinedSubclassesWithSameFieldNamesButDifferentTypesTest.java new file mode 100644 index 0000000000..8c59de5b5f --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hbm/inheritance/JoinedSubclassesWithSameFieldNamesButDifferentTypesTest.java @@ -0,0 +1,23 @@ +package org.hibernate.orm.test.hbm.inheritance; + +import org.hibernate.boot.MetadataSources; +import org.hibernate.engine.spi.SessionFactoryImplementor; + +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.orm.junit.ServiceRegistry; +import org.hibernate.testing.orm.junit.ServiceRegistryScope; +import org.junit.jupiter.api.Test; + +@ServiceRegistry +public class JoinedSubclassesWithSameFieldNamesButDifferentTypesTest { + + @Test + @TestForIssue(jiraKey = "HHH-15369") + public void testNoExceptionIsThrown(ServiceRegistryScope scope) { + try (final SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) new MetadataSources( scope.getRegistry() ) + .addResource( "org/hibernate/orm/test/hbm/inheritance/AnimalReport.hbm.xml" ) + .buildMetadata() + .buildSessionFactory()) { + } + } +}