I have two entities A and B given below
@Audited
Class A{
......
@ManytoOne
B b;
}
@Audited
Class B{
....
}
and also created the custom revision table having the username is new column.
there are 4 tables A,B,A_aud, B_aud.I have inserted some records in B table using inser query. I have writtent a Junit test case to insert the A Object. In that I have created the object of B by fetching the one record from table B. For this Envers ll make a entry for Only Object A in A and A_Aud. There ll not be new entry in B_aud and B.
I have written test case for controller to read the audit data
AuditQuery query = auditReader.createQuery()
.forRevisionsOfEntity(A.class, false, true)
above query returns the A Object and setProxy for relations(Many to one fro B). . While fetching records for given username it's throwing Exception :
org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException)
Is there any way to fetch the records from B tables if there is no audit entry for that revision ? Thanks, Sujata.
You'll need to insert records into B using Hibernate as well (.persist/.merge/.save), so that Envers can create the initial revision.
Adam