JPA Join example using Criteria

        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery cq = cb.createQuery(Email.class);
        Root root = cq.from(Email.class);
        Join accountJoin = root.join(Email_.account);
        Predicate predicate =cb.isMember(user, accountJoin.get(Account_.users)));
        cq.where(predicate);

Comments

Popular posts from this blog

How to get Active Transactions and Locks from MySQL

Example of a PAC file