Envers: unconsistent "java.sql.SQLException Invalid column name col_1_1_"

Description

  • 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>();

Environment

Eclipse Kepler, JUnit Test, Sybase 15 DB, JPA 2 + Hibernate 4.2.5.Final

Assignee

Unassigned

Reporter

Dimitri Darseyne

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure