0

I cannot get the AuditInfo columns to be created when using @ManyToMany relations. Both @Entity objects extend AbstractAuditable and the correct columns are created when using create-drop. The AutitInfo columns do not show in the auto created join table.

I see this post regarding Hibernate Audit info, and it says it should be autmatically created. Audit ManyToMany Relationships using Hibernate Envers
Should that work with Spring JPA since Hibernate is the provider?

Community
  • 1
  • 1
Chris Savory
  • 2,597
  • 1
  • 17
  • 27

2 Answers2

0

Spring Data auditing only captures the reference to latest modifying and creating user as well as the creation and modification date. It does not keep revisions of entities around. If you need the latter, the tool of choice is Hibernate Envers which we have a custom Spring Data extension for.

Oliver Drotbohm
  • 80,157
  • 18
  • 225
  • 211
  • 1
    I'm not trying to keep revision history. I'm just trying to get audit info working for a ManyToMany join table. I do not have an Entity object for the join table since it is inferred through the ManyToMany annotation. Therefore I cannot set the Auditing annotations or extend AbstractAuditable. – Chris Savory Jun 23 '14 at 14:20
  • Hi @oliver-gierke did you see my comment? – Chris Savory Jun 27 '14 at 14:22
0

My problem ended up being that I didn't include an orm.xml file included that declared an AuditingEntityListener. I had thought it would be enough to include the @EnableJpaAuditing annotation.

Chris Savory
  • 2,597
  • 1
  • 17
  • 27