[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3885) saving new entity with immutable natural id leads to NPE
Michael Kopp (JIRA)
noreply at atlassian.com
Wed May 6 15:18:15 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33117#action_33117 ]
Michael Kopp commented on HHH-3885:
-----------------------------------
No ;-). I saw it while stumbling over the other bug.
see line 87.
84 : Object loadedVal;
85 : if ( loaded == null ) {
86 : if ( snapshot == null) {
87 : snapshot = session.getPersistenceContext().getNaturalIdSnapshot( entry.getId(), persister );
88 : }
89 : loadedVal = snapshot[i];
line 89 will access the snapshot array even if nothing is found in the database --> NPE
> saving new entity with immutable natural id leads to NPE
> --------------------------------------------------------
>
> Key: HHH-3885
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3885
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.2.2
> Reporter: Michael Kopp
> Assignee: Diego Plentz
>
> checkNaturalId in DefaultFlushEntityEventListener gets a snapshot via getNaturalIdSnapshot if the loaded variable is null. The result of that is null if nothing exists in the database yet. A couple of lines down the variable is used without null check --> NPE.
> still there in trunk as well.
--
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