File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JPA Certification (OCEJPA) and the fly likes one query in 3 conditions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » JPA Certification (OCEJPA)
Bookmark "one query in 3 conditions" Watch "one query in 3 conditions" New topic

one query in 3 conditions

sepand minoo

Joined: Dec 25, 2012
Posts: 2

I have one table in database that contains 3 foreign keys to another tables(this three tables name are: manager,worker and employee). in each row only one foreign key is filled.I need to write one query that with attention which column of fk is filled in where clause specified condition is performed. I write simple query in jpa but doesn't work properly
select b from allEmployees b where :name OR = :name OR :name
do you have any idea?I have to resolve it but i don't have any idea
jagrutkumar dalwadi
Ranch Hand

Joined: Mar 26, 2009
Posts: 83

By looking at the query, it seems to be OK.
However can you please set setSqlEnabled property as true(in hibernate it is there, not sure about JPA) and check which query has been prepared by JPA?

Once you get simple query, you can fire on DB and check the expected behavior. If query is wrong, it means jpa query requires changes.
I agree. Here's the link:
subject: one query in 3 conditions
It's not a secret anymore!