Issue Type: Bug Bug
Affects Versions: 4.1.9
Assignee: Unassigned
Components: envers
Created: 28/Jan/13 3:15 AM
Description:

We have following mapping:

@Audited(withModifiedFlag=true)
@Entity
@Table(name="TM_TICKET")
public class Ticket { @OneToMany(fetch = FetchType.LAZY, mappedBy="ticket", targetEntity = Comment.class) private List<Comment> comments = new ArrayList<>(); }

Follow steps:
1. Update Ticket -> ModWorkUnit is created
2. ModWorkUnit generate modified flag values by comparing newState and oldState:

changes = verCfg.getEntCfg().get(getEntityName()).getPropertyMapper().map(sessionImplementor, data,
entityPersister.getPropertyNames(), newState, oldState);

Comparing causes lazy loading of comments.

There is no need to compare audited biderectional association, because every change in comments comes with CollectionChangeWorkUnit.

We have several audited biderectional associations. Every single update to ticket, causes multiple queries on database.

The same applies to other types of work units: CollectionChangeWorkUnit.generateData, DeleteWorkUnit.generateData and AddWorkUnit

Project: Hibernate ORM
Priority: Major Major
Reporter: Michal Kurtak
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira