0

I know from sample code how to write one query function like findAll():

        javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
    cq.select(cq.from(entityClass));
    return getEntityManager().createQuery(cq).getResultList();

But can i ask how to write query based on the where condition like name should bigger than 18, and i also confuse that how to write query based on left join right join or inner join?

Note that all the query return List result, my current way to do that is get result, and manipulate the List( like eliminate the element in the List, or combine two list)

Ken Chan
  • 84,777
  • 26
  • 143
  • 172
stackover
  • 122
  • 1
  • 7
  • Have a look at some good tutorial, try yourself and then come back with a concrete question, including details of what have you tried so far. – perissf Nov 13 '12 at 08:12
  • perhaps u can find your answer [here](http://stackoverflow.com/questions/3997070/jpa-criteria-tutorial)? – semTex Nov 13 '12 at 13:01

1 Answers1

0

See,

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/Criteria

For documentation and examples of using the Criteria API

James
  • 17,965
  • 11
  • 91
  • 146