I have a simple program with a Resource and List of ItemSelection like this
When i m adding resource with 3 elements in itemSelections, hibernate envers log correctly:
when i m updating one line in item_selection, i only see one update in sql but hibernate envers log this:
localhost sa@envers=# select * from item_selection_aud ;
rev | revtype | resource_id | list_order | hierarchy_value_code | hierarchy_code | hierarchy_level
-----+---------+-------------+------------+----------------------+----------------+-----------------
2 | 0 | 1 | 1 | hvalueCode3 | hcode3 | 3
2 | 0 | 1 | 0 | hvalueCode1 | hcode1 | 1
2 | 0 | 1 | 2 | hvalueCode2 | hcode2 | 2
3 | 0 | 1 | 0 | hvalueCode1 | CODE | 1
3 | 2 | 1 | 0 | hvalueCode1 | hcode1 | 1
(5 rows)
as you can see, i have a revtype 2 and 0 for the modified line instead of revtype 1 for an update. I'have try to use @Column(name = "hierarchy_code", nullable = false) but nothing change. For now my only solution is to transform @ElementCollection into @OneToMany, but I have many @ElementCollection in my application so too many refactoring... Did I miss something in the configuration? I am using DefaultAuditStrategy, same behavior with ValidityAuditStrategy that only add revend column. Hibernate-envers 5.6.12-Final |