We have a question about envers and the console demo source code.
In the console demo the Person entity has an Address
@Entity
public class Person {
@Id
@GeneratedValue
private int id;
@Audited
private String name;
@Audited
private String surname;
@Audited
@ManyToOne
private Address address;
.............................................
We changed the code of "modify person" (option 4 in the console) to also modify the address of the person.
When we execute the console demo option 4 with this values
------------------------------------
Person id: 1
Person name (NULL for null, enter for no change, current - James):
Person surname (NULL for null, enter for no change, current - Bond):
Person address id (NULL for null, enter for no change, current - 1): Street name (NULL for null, enter for no change, current - MI6): aa
House number (enter for no change, current - 18): 1
Flat number (enter for no change, current - 25): 2
-------------------------------------
Envers only insert a revision for the address, beacuse the person entity didnt change.
-------------------------------------------
Hibernate: update Address set flatNumber=?, houseNumber=?, streetName=? where id=?
Hibernate: insert into REVINFO (REV, REVTSTMP) values (null, ?)
Hibernate: call identity()
Hibernate: insert into his_Address_AUD (REVTYPE, flatNumber, houseNumber, streetName, id, REV) values (?, ?, ?, ?, ?, ?)
-------------------------------------------
Can you indicate Envers also insert a revision for the Person when the person address is modified?
Thanks!
Hello,
there's currently no such option. Audit entries will be done only for changed entities (and with appropriate settings, if the content of a contained collection changes).
Adam