JPA where clause any

Posted by Ke on Stack Overflow See other posts from Stack Overflow or by Ke
Published on 2010-03-13T02:34:54Z Indexed on 2010/03/13 2:57 UTC
Read the original article Hit count: 351

Filed under:

Hi,

I'm new to JPA.

In JPA, the query is:

 Query query = entityManager.createQuery("select o from Product o WHERE o.category = :value");
query.setParameter("category", category);

How can I set category to any category in JPA? So if the null category passed, I simple ignore the category parameter, select all products.

© Stack Overflow or respective owner

Related posts about jpa