Hi,
first of all: I am using Hibernate 3.2.2 GA - the newest version of hibernate.
I've got two classes: a class Event and a class Employee. The Event class has got a field employees which is a List of Employee-objects.
When I execute this query:
Code:
select e.employees from Event e
everything works properly. The generated SQL code is:
Code:
select employee2_.id as id6_, employee2_.personnelNumber as personne2_6_, employee2_.forename as forename6_, employee2_.surname as surname6_ from Events event0_ inner join Events_Employees employees1_ on event0_.id=employees1_.EventId inner join Employees employee2_ on employees1_.EmployeeId=employee2_.id
But when I add to the select another field, this happens:
HQL:
Code:
select e.employees, e.eventType from Event e
Generated SQL:
Code:
select . as col_0_0_, event0_.eventType as col_1_0_, employee2_.id as id6_, employee2_.personnelNumber as personne2_6_, employee2_.forename as forename6_, employee2_.surname as surname6_ from Events event0_ inner join Events_Employees employees1_ on event0_.id=employees1_.EventId inner join Employees employee2_ on employees1_.EmployeeId=employee2_.id
In the select statement, hibernate tries to fetch ". as col_0_0_" which is totally wrong...
Am I doing something wrong or why does this happen?
Regards,
Dominik