JOIN « EntityManager « JPA Q&A

1. Hibernate & EntityManager with joins

In my hypothetical I have an annotated User model class. This User model also holds references to two sets:

  • A set of Pet objects (a Pet object is also an annotated model ...

2. How to use JOIN using Hibernate's session.createSQLQuery()

I have two Entity (tables) - Employee & Project. An Employee can have multiple Projects. Project table's CREATOR_ID field refers to Employee table's ID field. Employee entity does not maintain any reference ...

3. Hibernate EntityManager + Query Cache - "join fetch" not working

I am trying to cache a query like this:

TypedQuery<Foo> q = em.createQuery(
    "SELECT foo FROM Foo foo " +
q.setHint("org.hibernate.cacheable", true);
The ...