Home » Java » java – How to write the JPQL equavalent of db.Person.find({_id:{pid:'1',email:'[email protected]'}})-Exceptionshub

java – How to write the JPQL equavalent of db.Person.find({_id:{pid:'1',email:'[email protected]'}})-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

How to convert the mongo db query into JPQL query
I have tried the followings but its returning empty list.

Query query = manager.createQuery("SELECT p FROM Person p WHERE p.pid =:pid AND p.email =:email");
query.setParameter("pid", 1);
query.setParameter("email", "[email protected]");
List recs = query.getResultList();
How to&Answers: