criteria « ID « JPA Q&A

1. How to do inner join using only ID in Hibernate Criteria API?

Assume I have this mapping:

class User {
    String name;
class Department {
    String id;
    User owner;

2. Is there any way to recover objects matching several criterias (not necessairly ID)?

I am working on a project that is using hibernate. We have a database and now I would like to query it. In the ideal case, I know I am able to ...

3. Criteria API Path to sub-sub-entity id

I want to transform my JPAQL queries into criteria API queries. Consider query like this:

SELECT e FROM Entity e WHERE = :parentId
WHERE part is transformed to:
Path<Long> parentId = root.get(Entity_.parent).get(;
Predicate whereParentId = ...

4. Criteria API + retrieving by id

Hi, I'm having a strange behavior: I'm using the Criteria API to retrieve rows from DB filtering by ID. Code: Destinatario dest = new Destinatario(); dest.setId(new Long(2)); Example ex = Example.create(dest); ...

5. Criteria with id

michael wrote: the id property is ignored in example queries. Just add a normal criterion. I strongly feel this is a bug. I fervently love the QBE functionality, but this was completely unexpected when I encountered it yesterday. Furthermore, are association classes also ignored in QBE? That is, if a child has an association to its parent, I have noticed that ...