According to JPA spec, this seems to be bug:
"4.8.1 Result Type of the SELECT Clause"
states:
"The type of the query result specified by the SELECT clause of a query
is an entity abstract schema type, a state-field type, the result of an
aggregate function, the result of a construction operation, or some
sequence of these."
Since "m, p" in the given query represents "some sequence of" entities,
it should be allowed.
Could anyone, please, confirm that this is erratic behavior before I
raise u bug in JIRA?
Regards,
Ognjen
Ognjen Blagojevic wrote:
Hi,
When I try to select multiple objects in a query like this one
(publisher of the magazine can be null - unknown):
SELECT m, p
FROM Magazine m
LEFT OUTER JOIN m.idPublisher p
WHERE ((:useName = false) OR (p.name like :name))
I would expect to get the resultset of pairs (Magazine, Publisher), but
what OpenJPA 1.1.0 returns is resultset of pairs (Publisher, Publisher).
Did anyone else noticed this behavior, and should I file a bug report?
Is it allowed in JPA spec to select multiple objects?
Regards,
Ognjen
ps. I know I could select just Magazine, and then get Publisher from
there. The actual query is more complex, this one is just for the
purpose of showing the bug.