I'm having a problem while making an HQL query with some classes which are equivalent to these ones:
Code:
public class Person{
private String name;
private String lastName;
... //getter & setter
}
public class Employer{
private int id;
private Person employerDetails;
private int role;
... //getter & setter
}
I'm mapping the Emplyer class over a table, with the employerDetails component mapped as a <component>.
The problem i'm seeing arises when i try to make the following HQL query:
Code:
SELECT employer
FROM Employer as employer
WHERE (employer.employerDetails) IN (:personList)
Where :personList is associated to an Array of Person objects.
When it gets translated into sql for DB2, it looks like this:
Code:
WHERE ((employer0_.EMPNAME, employer0_.EMPSURNAME) in ((?, ?) , (?, ?)))
Where hibernate correctly tries to fill the remaining ? with the input values from the array.
The problem is that DB2 returns me the following error:
Code:
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: (;_.EMPNAME) in (;<values>
Which says that it found a "(" past the "_.EMPNAME) in (" part, where it was expecting some <values>.
The whole impression is that I'm either making some errors into the HQL query syntax, or that it gets translated in the wrong way by the hibernate translator.
Any suggestions?
Hibernate version: 3.2.6 GA
Hibernate dialect: org.hibernate.dialect.DB2Dialect