@Audited
@Entity
public class Entity {
@Id
private long id;
private String value;
@OrderColumn
@ElementCollection
private List<Embeddable> embeddables;
...
...
}
Entity entity = new Entity();
entity.setId(1);
entity.setValue("a");
em.persist(entity);
This will create this audit record:
| id |
REV |
REVTYPE |
REVEND |
REVEND_TSTMP |
value |
value_MOD |
embeddables_MOD |
| 1 |
1 |
0 |
NULL |
NULL |
a |
1 |
1 |
However, if we update the entity after persist it. for example:
Entity entity = new Entity();
entity.setId(1);
entity.setValue("a");
em.persist(entity);
entity.setValue("b");
this will create this audit record:
| id |
REV |
REVTYPE |
REVEND |
REVEND_TSTMP |
value |
value_MOD |
embeddables_MOD |
| 1 |
1 |
0 |
NULL |
NULL |
a |
1 |
0 |
The value of column 'embeddables_MOD' changed from 1 to 0, though embeddables is not updated at all. |