HHH-15369 Add test for issue
This commit is contained in:
parent
fcabfa400a
commit
9f288c3520
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping package="org.hibernate.orm.test.hbm.inheritance">
|
||||
<class name="AnimalReport">
|
||||
<id name="id"/>
|
||||
<property name="name"/>
|
||||
<many-to-one class="Animal" name="animal" not-found="ignore"/>
|
||||
</class>
|
||||
|
||||
<class abstract="true" name="Animal">
|
||||
<id name="id"/>
|
||||
|
||||
<joined-subclass name="Cat">
|
||||
<key column="ANIMAL_ID"/>
|
||||
<many-to-one class="CatName" name="name" not-found="ignore"/>
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="Dog">
|
||||
<key column="ANIMAL_ID"/>
|
||||
<many-to-one class="DogName" name="name" not-found="ignore"/>
|
||||
</joined-subclass>
|
||||
</class>
|
||||
|
||||
<class name="CatName">
|
||||
<id name="id"/>
|
||||
<property name="name"/>
|
||||
</class>
|
||||
|
||||
<class name="DogName">
|
||||
<id name="id"/>
|
||||
<property name="name"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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()) {
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue