java - JPA 2 query giving strange behavior on OR clause -
i have jpa 2 query driving me nuts. surveyquestion may have organization. here's mapping within surveyquestion
@manytoone( optional=true ) @joincolumn( name="organization_key" ) private organization organization;
organization has field named key. create typednamedquery following jpql
select q surveyquestion q q.organization null or q.organization.key = :organizationkey
with query questions have given key. if remove q.organization.key = :organizationkey query, have no organization, can't life of me return combination of have no organization or have given organization.
jpa2 eclipselink provider.
this jpa standard.
q.organization.key
resolves inner join on q.organization, not left join!
you have this:
select q surveyquestion q left join q.organization o o null or o.key = :organizationkey
Comments
Post a Comment