[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3895) Accessing proxy will not unwrap / initialize entity if the accessed property is the primary-key / id of the entity
Diego Plentz (JIRA)
noreply at atlassian.com
Tue May 5 14:03:18 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33092#action_33092 ]
Diego Plentz commented on HHH-3895:
-----------------------------------
Ooops, I'm wrong the behavior is exactly the opposite. You must use getId instead of using the property acess directly.
> Accessing proxy will not unwrap / initialize entity if the accessed property is the primary-key / id of the entity
> ------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-3895
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3895
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.3.1
> Environment: Envers 3.5 with Hibernate Core, -annotations, -common-annotations 3.5 and Spring
> Reporter: Alexander Fröhlich
> Priority: Critical
>
> An audited entity - which is a property of the audited entity I fetch from db - will return null if I call getPk() / getID() on it, where pk / id is the primary key of the entity.
> mainEntity = auditReader.createQuery()for.....getSingleResult();
> mainEntity.getPk(); // returns pk - fine
> mainEntity.getPropertyEntity().getPk(); // returns null IF no other properties of 'propertyEntity' have been accessed before
> mainEntity.getPropertyEntity().getAnyOtherProperty(); // all fine
>
> see forum for more details:
> http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154798
--
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