HHH-15379 Add test for issue
This commit is contained in:
parent
d6f9b0b683
commit
c553d35a86
|
@ -0,0 +1,23 @@
|
|||
package org.hibernate.orm.test.hbm.mappingexception;
|
||||
|
||||
|
||||
public class Address {
|
||||
private Long id;
|
||||
private String details;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(String details) {
|
||||
this.details = details;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.hibernate.orm.test.hbm.mappingexception;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class Employee {
|
||||
|
||||
private long id;
|
||||
private boolean name;
|
||||
|
||||
private Set<Address> addresses;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Set<Address> getAddresses() {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
public void setAddresses(Set<Address> addresses) {
|
||||
this.addresses = addresses;
|
||||
}
|
||||
}
|
|
@ -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 UnmappedCollectionExceptionTest {
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-15379")
|
||||
public void mappingExceptionTest() {
|
||||
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
|
||||
try {
|
||||
assertThrows( MappingException.class, () -> {
|
||||
new MetadataSources( ssr )
|
||||
.addResource( "org/hibernate/orm/test/hbm/mappingexception/unmapped_collection.hbm.xml" )
|
||||
.buildMetadata();
|
||||
|
||||
} );
|
||||
}
|
||||
finally {
|
||||
ssr.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?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="Employee">
|
||||
<id column="EMPLOYEE_ID" name="id">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
<property column="EMPLOYEE_NAME" name="name"/>
|
||||
<!-- Address has not a hbm mapping -->
|
||||
<set name="addresses">
|
||||
<key column="EMPLOYEE_ID"/>
|
||||
<many-to-many class="Address"/>
|
||||
</set>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
Loading…
Reference in New Issue