Search in sources :

Example 1 with JPAJoin

use of com.peterphi.std.guice.hibernate.webquery.impl.jpa.jpafunctions.JPAJoin in project stdlib by petergeneric.

the class JPAQueryBuilder method getOrCreateJoin.

/**
 * Ensure a join has been set up for a path
 *
 * @param path
 *
 * @return
 */
@Override
public JPAJoin getOrCreateJoin(final WQPath path) {
    if (path == null)
        return new JPAJoin(criteriaBuilder, entity, root, false);
    if (!joins.containsKey(path.getPath())) {
        final JPAJoin parent = getOrCreateJoin(path.getTail());
        final JPAJoin join = parent.join(path.getHead().getPath());
        joins.put(path.getPath(), join);
        return join;
    } else {
        return joins.get(path.getPath());
    }
}
Also used : JPAJoin(com.peterphi.std.guice.hibernate.webquery.impl.jpa.jpafunctions.JPAJoin)

Aggregations

JPAJoin (com.peterphi.std.guice.hibernate.webquery.impl.jpa.jpafunctions.JPAJoin)1