Test case for HHH-11502
This commit is contained in:
parent
f3dafb3205
commit
8d726a35b1
|
@ -0,0 +1,25 @@
|
|||
package org.hibernate.boot.model.source.internal.hbm;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
public class AnnotationEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "annotationentity_id_seq")
|
||||
@SequenceGenerator(
|
||||
name = "annotationentity_id_seq",
|
||||
sequenceName = "annotationentity_id_seq"
|
||||
)
|
||||
private Long _id;
|
||||
|
||||
/**
|
||||
* Get the identifier.
|
||||
*
|
||||
* @return the id.
|
||||
*/
|
||||
public Long getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.hibernate.boot.model.source.internal.hbm;
|
||||
|
||||
public class HBMEntity {
|
||||
|
||||
private long _id;
|
||||
private AnnotationEntity _association;
|
||||
|
||||
public long getId() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public AnnotationEntity getAssociation() {
|
||||
return _association;
|
||||
}
|
||||
|
||||
public void setAssociation(AnnotationEntity association) {
|
||||
_association = association;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package org.hibernate.boot.model.source.internal.hbm;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* https://hibernate.atlassian.net/browse/HHH-11502
|
||||
*
|
||||
* @author Russ Tennant (russ@venturetech.net)
|
||||
*/
|
||||
public class HBMManyToOneAnnotationMissingPrimaryKeyTest extends BaseNonConfigCoreFunctionalTestCase
|
||||
{
|
||||
@Override
|
||||
protected Class[] getAnnotatedClasses() {
|
||||
return new Class[]{
|
||||
AnnotationEntity.class
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getMappings() {
|
||||
return new String[]{
|
||||
"HBMEntity.hbm.xml"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "/org/hibernate/boot/model/source/internal/hbm/";
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to trigger the NullPointerException in the ModelBinder.
|
||||
* @throws Exception on error.
|
||||
*/
|
||||
@Test
|
||||
public void hhh11502() throws Exception {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<!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.boot.model.source.internal.hbm">
|
||||
<class name="HBMEntity" table="hbmentity" >
|
||||
<id name="id" unsaved-value="0">
|
||||
<generator class="sequence">
|
||||
<param name="sequence">hbmentity_id_sequence</param>
|
||||
</generator>
|
||||
</id>
|
||||
<many-to-one name="association" cascade="persist,save-update" not-null="true"/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
Loading…
Reference in New Issue