-
We implement a simple Envers Audit exemple on a @ManyToMany HashSet relation. (Projects have many Employees, as participants, Employees have many Projects).
-
Both entities Project & Employee are correctly Envers Audited, (with dedicated tables + one additional intermediate table for n/n relation)
-
When AuditReader is fetching the "participants" relations the generated SQL is correct (and running OK in a separate SQL client) but...
-
When executed (through a JUnit test client in Eclipse), a strange "java.sql.SQLException: Invalid column name col_1_1_" is thrown
but no alias named "col_1_1_" is mentionned inside of the (correctly oustide executed) SQL request !
the Hibernate Envers + JPA definition of the relation:
@AuditJoinTable(name="PROJECT_PARTICIPANT_VERSION", inverseJoinColumns=@JoinColumn(name="EMPLOYEE_ID", referencedColumnName="ID")) @ManyToMany(fetch=FetchType.LAZY) @JoinTable( name="PROJECT_PARTICIPANT", joinColumns=@JoinColumn(name="PROJECT_ID", referencedColumnName="ID"), inverseJoinColumns=@JoinColumn(name="EMPLOYEE_ID", referencedColumnName="ID")) @Getter @Setter private Set<Employee> participants = new HashSet<Employee>();
|