[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-7225) NullPointerException after persisting null entity value as natural-Id

Guenther Demetz (JIRA) noreply at atlassian.com
Thu Apr 5 08:12:48 EDT 2012


     [ https://hibernate.onjira.com/browse/HHH-7225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guenther Demetz updated HHH-7225:
---------------------------------

    Attachment: TestCaseHHH-7225.jar

adds new entity class and a testmethod to org.hibernate.test.naturalid.nullable.NullableNaturalIdTest

> NullPointerException after persisting null entity value as natural-Id
> ---------------------------------------------------------------------
>
>                 Key: HHH-7225
>                 URL: https://hibernate.onjira.com/browse/HHH-7225
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.1.2
>            Reporter: Guenther Demetz
>            Priority: Minor
>              Labels: naturalid
>         Attachments: TestCaseHHH-7225.jar
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> This request is basically a reopening of HHH-7158. 
> story-line:
> -Fixing of HHH-7158 did successfully solve both attached testmethods, but only the first one was integrated into hibernate matrix tests.
> -Fixing of HHH-7206 did slightly change the way how natural-id-vales are compared, causing now testmethod2 fail again.
>   before HHH-7206:
> {code}
>                         // lengths have already been verified at this point
>                         for ( int i = 0; i < naturalIdTypes.length; i++ ) {
>                                 if ( ! naturalIdTypes[i].isEqual( naturalIdValues[i], values[i] ) ) {
>                                         return false;
>                                 }
>                         }
> {code}
>  after HHH-7206: (please notice now there has appeared *persister.getFactory()* as third parameter)
> {code}
>                         // lengths have already been verified at this point
> 			for ( int i = 0; i < naturalIdTypes.length; i++ ) {
> 				if ( ! naturalIdTypes[i].isEqual( values[i], otherValues[i], persister.getFactory() ) ) {
> 					return false;
> 				}
> 			}
> 			return true;
> {code}
> Proposed solutions:
> Either revert back to using the isEqual method again with 2 parameters only,
> or alternatevely make method 
> EntityType#isEqual(Object x, Object y, SessionFactoryImplementor factory) 
> stable against null x,y values as proposed in HHH-7158.
> I don't know which one is the better solution, but both solution make the attached testcases go through without fails.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list