HHH-15354 Add test for issue
This commit is contained in:
parent
0777f7941c
commit
48e3bf8381
|
@ -0,0 +1,23 @@
|
|||
package org.hibernate.orm.test.hbm.mappingexception;
|
||||
|
||||
public class Person {
|
||||
|
||||
private long id;
|
||||
private boolean name;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(boolean name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.hibernate.orm.test.hbm.mappingexception;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class UnmappedAssociationExceptioTest {
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-15354")
|
||||
public void mappingExceptionTest() {
|
||||
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
|
||||
try {
|
||||
assertThrows( MappingException.class, () -> {
|
||||
new MetadataSources( ssr )
|
||||
.addResource( "org/hibernate/orm/test/hbm/mappingexception/unmapped_association.hbm.xml" )
|
||||
.buildMetadata();
|
||||
|
||||
} );
|
||||
}
|
||||
finally {
|
||||
ssr.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
-->
|
||||
<!DOCTYPE hibernate-mapping SYSTEM "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
|
||||
|
||||
<hibernate-mapping package="org.hibernate.orm.test.hbm.mappingexception">
|
||||
|
||||
<class name="Person">
|
||||
<id column="PERSON_ID" name="id">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
<property column="PERSON_NAME" name="name"/>
|
||||
<many-to-one class="UnmappedClass" column="UNMAPPED_ID" name="unmapped"/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
Loading…
Reference in New Issue