Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...ate-core/src/test/java/org/hibernate/boot/model/source/internal/hbm/AnnotationEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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; | |||
} | |||
} |
23 changes: 23 additions & 0 deletions
23
hibernate-core/src/test/java/org/hibernate/boot/model/source/internal/hbm/HBMEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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; | |||
} | |||
} |
41 changes: 41 additions & 0 deletions
41
...hibernate/boot/model/source/internal/hbm/HBMManyToOneAnnotationMissingPrimaryKeyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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); | |||
} | |||
} |
16 changes: 16 additions & 0 deletions
16
...te-core/src/test/resources/org/hibernate/boot/model/source/internal/hbm/HBMEntity.hbm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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> |