I went and tested that and it actually failed... I also tried id=? instead of the ?
Here's the error (Different classes, same type of setup)
Caused by: java.sql.SQLException: Syntax error or access violation, message from server: "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 'select roles1_.role_id from adminGroup_Role roles1_ where group"
Code used:
Code:
Group g where ? in elements(g.roles)
The sql it generated looks like:
Code:
Hibernate: select group0_.id as id, group0_.name as name, group0_.description as descript3_ from adminGroup group0_ where (id=? in(select roles1_.role_id from adminGroup_Role roles1_ where group0_.id=roles1_.group_id))
Or without the id=
Hibernate: select group0_.id as id, group0_.name as name, group0_.description as descript3_ from adminGroup group0_ where (? in(select roles1_.role_id from adminGroup_Role roles1_ where group0_.id=roles1_.group_id))
in this case I have a Group and the group has a set of Role objects, trying to get all the groups containing a specific role object. Any more ideas?
thanks in advance,
David