Hi forum,
I have the following problem:
I create the following query:
Code:
String q = "select new Guest(g.id, g.firstName, g.lastName, g.invitations) from Guest g";
List list = getHibernateTemplate().find(q);
Guest has the appropriate constructor. The problem comes up with
g.invitations where g.invitations is a
onetomany relation.
Hibernate throws an exception
"could not execute query" Code:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as col_3_0_ from net_guestmanager_guests guest0_ inner join net_guestmanager...' at line 1
and produces the following SQL
Code:
select guest0_.id as col_0_0_, guest0_.first_name as col_1_0_, guest0_.last_name as col_2_0_, . as col_3_0_
from net_guestmanager_guests guest0_ inner join net_guestmanager_invitation_list invitation1_ on guest0_.id=invitation1_.guest_fk
I have no idea what went wrong. I try to search for similar things but did not find whether it is possible at all to do such a query.
Does anybody has an idea?
Thanks in advance
John