I have two entity's "Application" and "ApplicationDocument"
Table 1
@Entity
@Table(name = "applications")
@EntityListeners(AuditingEntityListener.class)
public class Application {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Audited
private String title;
@OneToMany(mappedBy = "application")
@JsonManagedReference
@AuditJoinTable
private List<ApplicationDocument> applicationDocuments;
}
Table 2
@Entity
@Table(name = "applicationDocuments")
public class ApplicationDocument {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", nullable = false)
private Long id;
@ManyToOne()
@JoinColumn(name = "applicationid")
@JsonBackReference
@Audited
private Application application;
@Audited
private String file;
}
This will create two audit tables, and the data is revisioned every time after insert, update and delete. Works fine till here
But to retrieve revisions
I have a ApplicationRepository which extends springs "RevisionRepository"
So when I fetch something like applicationRepository.getRevisions({{myApplicationId}}). Then when I look at revision entities returned, the one to many relation is always returned as null.
I would expect it to return a list with whatever ApplicationDocuments existed during that revision time.
Any ideas what am I missing here