Search in sources :

Example 1 with QRelation

use of com.peterphi.std.guice.hibernate.webquery.impl.QRelation in project stdlib by petergeneric.

the class JPAJoin method join.

public JPAJoin join(final String relation) {
    final QRelation rel = entity.getRelation(relation);
    final JoinType joinType;
    // For non-nullable non-collection joins, use an INNER join instead of a LEFT join
    if (!rel.isNullable() && !rel.isCollection())
        joinType = JoinType.INNER;
    else
        joinType = JoinType.LEFT;
    final Join<Object, Object> join = root.join(relation, joinType);
    return new JPAJoin(builder, rel, join, rel.isCollection());
}
Also used : QRelation(com.peterphi.std.guice.hibernate.webquery.impl.QRelation) JoinType(javax.persistence.criteria.JoinType)

Aggregations

QRelation (com.peterphi.std.guice.hibernate.webquery.impl.QRelation)1 JoinType (javax.persistence.criteria.JoinType)1