Skip to main content

Simple JPA query will not return expected result

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
jim_webguru
Offline
Joined: 2009-04-22
Points: 0

I'm hoping that this is an easy problem to fix.
I have a simple JPA query like this:
SELECT o FROM Client o WHERE o.company IS NULL OR NOT(o.company.companyID = 1)

I can not get the results from both conditions in my clause. The is null condition does nothing when i have the other condition in place. I get results if i use either condition by itself, but only the results from the companyID =1 if I put them together.
Not sure what I can do to fix this without going to a native query. Quite annoying.