[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5167) NullPointerException on double-save of versioned entity

Gail Badner (JIRA) noreply at atlassian.com
Tue Apr 27 17:27:33 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36735#action_36735 ] 

Gail Badner commented on HHH-5167:
----------------------------------

I suspect there is something wrong with your mapping.

Please get help on the user forum (https://forum.hibernate.org/).

Thanks,
Gail

> NullPointerException on double-save of versioned entity
> -------------------------------------------------------
>
>                 Key: HHH-5167
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5167
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.2
>         Environment: PostgreSQL 8.3.3, Hibernate 3.3.2.GA (2009-06-24)
>            Reporter: Robert Hailey
>            Assignee: Gail Badner
>            Priority: Minor
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> (psuedocode)
> VersionedPojo v=new VersionedPojo();
> session.save(v);
> String secondary=functionNeedingId(v.getId());
> v.setSecondary(secondary);
> session.saveOrUpdate(v);
> --
> A common example of a function needing an id might include the saving of a many-to-one relationships. This stack trace has been seen in forum posts and is very likely to be this same issue.
> --
> java.lang.NullPointerException
> 	at org.hibernate.type.LongType.next(LongType.java:79)
> 	at org.hibernate.engine.Versioning.increment(Versioning.java:131)
> 	at org.hibernate.event.def.DefaultFlushEntityEventListener.getNextVersion(DefaultFlushEntityEventListener.java:387)
> 	at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:279)
> 	at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:151)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
> 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
> 	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
> 	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
> 	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list