[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5845) Lazy Loading of audited entites with revision type 'delete'

Lukasz Antoniak (JIRA) noreply at atlassian.com
Tue Apr 3 17:19:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-5845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46174#comment-46174 ] 

Lukasz Antoniak commented on HHH-5845:
--------------------------------------

Pull request submitted: https://github.com/hibernate/hibernate-orm/pull/301
Please notice that we don't plan to release another version of 3.6 branch.

> Lazy Loading of audited entites with revision type 'delete'
> -----------------------------------------------------------
>
>                 Key: HHH-5845
>                 URL: https://hibernate.onjira.com/browse/HHH-5845
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.5.6
>         Environment: Hibernate 3.5.6, Oracle 10 DB
>            Reporter: Jonas S.
>            Assignee: Lukasz Antoniak
>         Attachments: hhh5845_testcase.zip
>
>
> Two classes are given, and they are related via a OneToOne relationship:
> @Audited
> public class MyClass {
>     @OneToOne
>     @Cascade(value = CascadeType.ALL)
>     private MyOtherClass otherClass;
> }
> @Audited
> public class MyOtherClass {
> }
> The property "org.hibernate.envers.store_data_at_delete" is set to true, and when auditquerying for the deleted objects and initiliazing the otherClass (an entity which is also deleted) property, and ObjectNotFoundExceptions is thrown. It seems that the proxies do not look for deleted entities, because the same query works fine for the entities of revision type 'ADD' and 'MOD'. The code of the query:
> AuditQuery queryDeleted = reader.createQuery().forRevisionsOfEntity(
>                 MyClass.class, false, true).add(
>                 AuditEntity.revisionType().eq(RevisionType.DEL));
> List queryResult = queryDeleted.getResultList();
> List<MyClass> result = new ArrayList<MyClass>();
> for (Object object : queryResult) {
>      Object[] oArray = (Object[]) object;
>      MyClass c = (MyClass) oArray[0];
>      Hibernate.initialize(c.getOtherClass());
> }
> Forum post with Adam Warski's response:
> http://community.jboss.org/thread/160939?tstart=0

--
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