[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5142?page=c...
]
Adam Warski commented on HHH-5142:
----------------------------------
Hello, the patch looks good, but could you add a separate test that uses
M2MIndexedListTargetNotAuditedEntity (instead of expanding the M2MRelationNotAuditedTarget
test)? Also, in the separate test could you add some more checks, e.g. that the sorting
works properly (add two elements in one rev, swap their positions in the next etc)?
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:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira