[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6317) Retrieving
Lukasz Antoniak (JIRA)
noreply at atlassian.com
Wed Jul 20 19:28:17 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43008#comment-43008 ]
Lukasz Antoniak commented on HHH-6317:
--------------------------------------
Pull request submitted: https://github.com/hibernate/hibernate-core/pull/138
> Retrieving
> -----------
>
> Key: HHH-6317
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6317
> Project: Hibernate Core
> Issue Type: Bug
> Components: envers
> Affects Versions: 3.6.5
> Reporter: Clint Popetz
> Assignee: Lukasz Antoniak
>
> For the following mapping:
> {code}
> public class AnEntity extends HibernatePersistedObject {
> @Id
> @GeneratedValue
> private Long id;
> @OneToOne(optional=false,mappedBy="anEntity")
> private TargetEntity target;
> }
> public class TargetEntity {
> @Id
> @GeneratedValue
> private Long id;
> @ManyToOne
> private AnEntity anEntity;
> }
> {code}
> and the following query:
> {code}
> AuditReaderFactory.get(em).createQuery().
> forRevisionsOfEntity(AnEntity.class,false,false).
> add(AuditEntity.id().eq(id)).addOrder(AuditEntity.revisionNumber().desc()).
> setMaxResults(1).getSingleResult()
> {code}
> I get an NPE because the there is no EntityConfiguration for TargetEntity, as it is not audited:
> {noformat}
> java.lang.NullPointerException
> at org.hibernate.envers.query.impl.EntitiesAtRevisionQuery.list(EntitiesAtRevisionQuery.java:81)
> at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108)
> at org.hibernate.envers.entities.mapper.relation.OneToOneNotOwningMapper.mapToEntityFromMap(OneToOneNotOwningMapper.java:82)
> at org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:118)
> at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:100)
> at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:135)
> at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108)
> {noformat}
--
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