Answer the question
In order to leave comments, you need to log in
How to write a Criteria hibernate join query?
Help me make a CRITERIA request, or send a tutorial explaining how to do it, or explain to me with this example what is substituted where!...
Where the relation of userentity to statgame is one to many.
The SQL query is "SELECT * FROM testproj.userentity u JOIN testproj.statgame s ON u.id=s.userid WHERE u.id= :id" <- this should be dynamically populated as needed.
Answer the question
In order to leave comments, you need to log in
What for?!
You will have a simple select like
A statgame pull through @OneToMany
Simple select in CriteriaAPI
...
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<userentity > q = cb.createQuery(userentity .class);
Root<userentity > c = q.from(userentity .class);
ParameterExpression<Integer> p = cb.parameter(Integer.class);
q.select(c).where(cb.gt(c.get("id"), p));
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question