Enhance Ejb3XmlTest to try to persist an entity mapped using <map-key-class> in the orm.xml
This commit is contained in:
parent
b3aa9e0c28
commit
7d884f4bb6
|
@ -0,0 +1,10 @@
|
|||
package org.hibernate.test.annotations.xml.ejb3;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.MapKeyClass;
|
||||
|
||||
public class Company {
|
||||
int id;
|
||||
Map organization;
|
||||
}
|
|
@ -67,6 +67,17 @@ public class Ejb3XmlTest extends TestCase {
|
|||
tx.rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
public void testMapKeyClass() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction tx = s.beginTransaction();
|
||||
Company company = new Company();
|
||||
s.persist( company );
|
||||
s.flush();
|
||||
s.clear();
|
||||
tx.rollback();
|
||||
s.close();
|
||||
}
|
||||
|
||||
protected Class[] getAnnotatedClasses() {
|
||||
return new Class[]{
|
||||
|
@ -83,7 +94,8 @@ public class Ejb3XmlTest extends TestCase {
|
|||
return new String[]{
|
||||
"org/hibernate/test/annotations/xml/ejb3/orm.xml",
|
||||
"org/hibernate/test/annotations/xml/ejb3/orm2.xml",
|
||||
"org/hibernate/test/annotations/xml/ejb3/orm3.xml"
|
||||
"org/hibernate/test/annotations/xml/ejb3/orm3.xml",
|
||||
"org/hibernate/test/annotations/xml/ejb3/orm4.xml"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package org.hibernate.test.annotations.xml.ejb3;
|
||||
|
||||
public class VicePresident {
|
||||
int id;
|
||||
String name;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm/orm_2_0.xsd"
|
||||
version="2.0">
|
||||
<package>org.hibernate.test.annotations.xml.ejb3</package>
|
||||
<entity class="Company" access="FIELD" metadata-complete="true">
|
||||
<attributes>
|
||||
<id name="id"/>
|
||||
<one-to-many name="organization" target-entity="VicePresident">
|
||||
<map-key-class class="java.lang.String" />
|
||||
</one-to-many>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="VicePresident" access="FIELD" metadata-complete="true">
|
||||
<attributes>
|
||||
<id name="id"/>
|
||||
<basic name="name"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
Loading…
Reference in New Issue