i want to Map a map in JPA, but I get a Exception: My java-code looks like that:
Issue.java:
@ElementCollection
@CollectionTable(
name="ISSUE_EMPLOYEE",
joinColumns=@JoinColumn(name="ISSUE_ID", referencedColumnName="ID")
)
@MapKeyColumn(name="EMPLOYEEPOSITION_ID")
@MapKeyConvert("myEnumConverter")
@JoinColumn(name="EMPLOYEE_ID")
private Map<EmployeePosition, Employee> namedEmployees = new Hashtable<EmployeePosition, Employee>();
EmployeePosition
is a Enum
andEmployee
is a Entity
.
I get this Exception :
Internal Exception: java.sql.SQLException: ORA-00904: "EMPLOYEES": invalid identifier
Error Code: 904 Call: INSERT INTO ISSUE_EMPLOYEE (ISSUE_ID, EMPLOYEES, EMPLOYEEPOSITION_ID) VALUES (?, ?, ?) bind => [27, [B@18b85d, SERVICE]
It seems to ignore the @JoinColumn
annotation and tries to insert the object in the DB.
What´s wrong with my mapping/Is it possible to match Entities like this?