Search in sources :

Example 21 with ObjectExpression

use of org.eclipse.persistence.internal.expressions.ObjectExpression in project eclipselink by eclipse-ee4j.

the class FromImpl method join.

@Override
public <Y> Join<X, Y> join(SingularAttribute<? super X, Y> attribute, JoinType jt) {
    if (((SingularAttribute) attribute).getType().getPersistenceType().equals(PersistenceType.BASIC)) {
        throw new IllegalStateException(ExceptionLocalization.buildMessage("CAN_NOT_JOIN_TO_BASIC"));
    }
    Class<Y> clazz = attribute.getBindableJavaType();
    Join<X, Y> join = null;
    ObjectExpression exp = ((ObjectExpression) this.currentNode).newDerivedExpressionNamed(attribute.getName());
    if (jt.equals(JoinType.LEFT)) {
        exp.doUseOuterJoin();
    } else if (jt.equals(JoinType.RIGHT)) {
        throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED"));
    } else {
        exp.doNotUseOuterJoin();
    }
    join = new JoinImpl<X, Y>(this, this.metamodel.managedType(clazz), this.metamodel, clazz, exp, attribute, jt);
    this.joins.add(join);
    ((FromImpl) join).isJoin = true;
    return join;
}
Also used : SingularAttribute(jakarta.persistence.metamodel.SingularAttribute) ObjectExpression(org.eclipse.persistence.internal.expressions.ObjectExpression)

Aggregations

ObjectExpression (org.eclipse.persistence.internal.expressions.ObjectExpression)21 Expression (org.eclipse.persistence.expressions.Expression)11 QueryKeyExpression (org.eclipse.persistence.internal.expressions.QueryKeyExpression)10 ArrayList (java.util.ArrayList)7 DatabaseMapping (org.eclipse.persistence.mappings.DatabaseMapping)5 ObjectLevelReadQuery (org.eclipse.persistence.queries.ObjectLevelReadQuery)4 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)3 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)3 BaseExpression (org.eclipse.persistence.internal.expressions.BaseExpression)3 ConstantExpression (org.eclipse.persistence.internal.expressions.ConstantExpression)3 FieldExpression (org.eclipse.persistence.internal.expressions.FieldExpression)3 DatabaseTable (org.eclipse.persistence.internal.helper.DatabaseTable)3 ForeignReferenceMapping (org.eclipse.persistence.mappings.ForeignReferenceMapping)3 SingularAttribute (jakarta.persistence.metamodel.SingularAttribute)2 Iterator (java.util.Iterator)2 FunctionExpression (org.eclipse.persistence.internal.expressions.FunctionExpression)2 ParameterExpression (org.eclipse.persistence.internal.expressions.ParameterExpression)2 TableExpression (org.eclipse.persistence.internal.expressions.TableExpression)2 FetchGroup (org.eclipse.persistence.queries.FetchGroup)2 IOException (java.io.IOException)1