Brian Topping created OPENJPA-2268:
--------------------------------------
Summary: SQL Generation with query using IN element
Key: OPENJPA-2268
URL: https://issues.apache.org/jira/browse/OPENJPA-2268
Project: OpenJPA
Issue Type: Bug
Components: jdbc, kernel, sql
Affects Versions: 2.2.0
Reporter: Brian Topping
Hi all, I've been staring at a problem for the last 12 hours with a JPQL query
that appears to be parsing incorrectly. There are three tables, a permissions
table with a n-n relation to a role table, in turn with an n-n relation to a
users table. The intent of the query is to get all permissions for a user by
username: {{select p from PersistentPermission p, IN(p.roles) r, IN(r.users) u
where u.username = :name}}.
No errors are generated, but the SQL emitted to the log has not been parsed or
transformed at all. (This may be correct, I've been fortunate enough so far
not to have to look at the SQL generated by OpenJPA).
Debugging into OpenJPA, it appears that the generated query is "select
permission p where username='?'", which obviously will not return anything.
I'm still debugging this (having gotten down to the level of the jflex code),
but it's my first time going deep on OpenJPA like this so things are going
slow. I'll post updates here, but if anyone sees this and has ideas of where
to look first (no matter how small), it may be a great help.
Thank you1
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira