1

I want to create a query that will select all positions by the id of the smartphone with the CriteriaBuilder in the abstract facade

public List<T> findAllById(int id) {
    javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
    cq.select(cq.from(entityClass));
    return getEntityManager().createQuery(cq).getResultList();
}

class diagram

Marvin
  • 13,325
  • 3
  • 51
  • 57
Hamza
  • 49
  • 8
  • "positions", "id", "smartphone" are all undefined for potential readers. They know nothing about how they are related to one another. Unless you make things clearer, you will get only some guesses - not a full-worthy answer. http://stackoverflow.com/help/mcve – Tiny Jan 07 '16 at 18:52
  • @HamzaElgarni Use Joins to relate `smartphone`, `position` and `message` See [this](http://stackoverflow.com/a/17155157/599528) example – Jacob Jan 25 '16 at 15:23

0 Answers0