]
Vladimir Klyushnikov updated HHH-5142:
--------------------------------------
Attachment: HHH-5142.patch
Attached a patch with fix and test. Patch is created over 3.6.0 trunk. Hope it can be
backported to 3.5.x
Exception when initializing lazy @ManyToMany indexed collection
containing not audited entities
-----------------------------------------------------------------------------------------------
Key: HHH-5142
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5142
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.1
Environment: Hibernate Core 3.5.1
Reporter: Vladimir Klyushnikov
Assignee: Adam Warski
Priority: Blocker
Attachments: HHH-5142.patch, testcase.zip
Hi,
I am getting exception when executing following code:
{code}
@Entity
@Audited
public class M2MIndexedListEntity {
...
@ManyToMany(cascade = CascadeType.ALL)
@OrderColumn(name="sortOrder")
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
private List<NotAuditedEntity> list = new ArrayList<NotAuditedEntity>();
}
@Entity
public class NotAuditedEntity {
...
}
...
M2MIndexedListEntity entity = (M2MIndexedListEntity) auditReader.createQuery()
.forRevisionsOfEntity(M2MIndexedListEntity.class, true, false)
.getSingleResult();
assertEquals(1,entity.getList().size());
{code}
Stack trace is the following:
{code}
java.lang.ClassCastException: testapp.NotAuditedEntity cannot be cast to java.util.Map
at
org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:67)
at
org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:39)
at
org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:67)
at
org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50)
at
org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.size(CollectionProxy.java:55)
{code}
I've attached a full test case. Unzip it, run *mvn test* and see test failing
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: