[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-7236) Natural-id : NullPointerException after persisting null String value, if using @NaturalIdCache
Strong Liu (JIRA)
noreply at atlassian.com
Thu May 3 02:59:48 EDT 2012
[ https://hibernate.onjira.com/browse/HHH-7236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Strong Liu resolved HHH-7236.
-----------------------------
Resolution: Fixed
Fix Version/s: 4.1.3
> Natural-id : NullPointerException after persisting null String value, if using @NaturalIdCache
> ----------------------------------------------------------------------------------------------
>
> Key: HHH-7236
> URL: https://hibernate.onjira.com/browse/HHH-7236
> Project: Hibernate ORM
> Issue Type: Bug
> Components: caching (L2), core
> Affects Versions: 4.1.2
> Reporter: Guenther Demetz
> Assignee: Strong Liu
> Fix For: 4.1.3
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Following new matrix testmethod
> {code:title=org.hibernate.test.naturalid.mutable.cached.CachedMutableNaturalIdTest.java|borderStyle=solid}
> @Test
> public void testNaturalIdPersistNullValue() {
> Session session = openSession();
> session.beginTransaction();
> Another it = new Another();
> it.setName(null);
> session.save( it );
> session.getTransaction().commit(); // throws NPE
> session.close();
> }
> {code}
> raises:
> java.lang.NullPointerException
> at org.hibernate.type.descriptor.java.AbstractTypeDescriptor.extractHashCode(AbstractTypeDescriptor.java:88)
> at org.hibernate.type.AbstractStandardBasicType.getHashCode(AbstractStandardBasicType.java:201)
> at org.hibernate.type.AbstractStandardBasicType.getHashCode(AbstractStandardBasicType.java:205)
> at org.hibernate.cache.spi.NaturalIdCacheKey.<init>(NaturalIdCacheKey.java:79)
> at org.hibernate.engine.internal.StatefulPersistenceContext$1.managedSharedCacheEntries(StatefulPersistenceContext.java:1801)
> at org.hibernate.engine.internal.StatefulPersistenceContext$1.manageSharedNaturalIdCrossReference(StatefulPersistenceContext.java:1792)
> at org.hibernate.action.internal.AbstractEntityInsertAction.handleNaturalIdPostSaveNotifications(AbstractEntityInsertAction.java:198)
> at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:130)
> at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:275)
> at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
> at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
> at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1181)
> at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:379)
> at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
> at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
> at org.hibernate.test.naturalid.mutable.cached.CachedMutableNaturalIdTest.testNaturalIdPersistNullValue(CachedMutableNaturalIdTest.java:127)
> ...
> N.B.: The exception does not happen without the @NaturalIdCache annotation
> Proposed solution: see pull request
--
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