private <Y> CollectionJoinImplementor<X, Y> constructJoin( CollectionAttribute<? super X, Y> collection, JoinType jt) { if ( jt.equals( JoinType.RIGHT ) ) { throw new UnsupportedOperationException( "RIGHT JOIN not supported" ); } // TODO : runtime check that the attribute in fact belongs to this From's model/bindable final Class<Y> attributeType = collection.getBindableJavaType(); return new CollectionAttributeJoin<X, Y>( criteriaBuilder(), attributeType, this, collection, jt ); }
public <Y> CollectionJoin<X, Y> join(CollectionAttribute<? super X, Y> collection, JoinType jt) { org.eclipse.persistence.expressions.Expression node; Class clazz = collection.getBindableJavaType(); CollectionJoin<X, Y> join = null; if (jt.equals(JoinType.INNER)) { node = this.currentNode.anyOf(collection.getName()); } else if (jt.equals(JoinType.RIGHT)) { throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED")); } else { node = this.currentNode.anyOfAllowingNone(collection.getName()); } if (collection.getElementType().getPersistenceType().equals(PersistenceType.BASIC)) { join = new BasicCollectionJoinImpl<X, Y>(this, this.metamodel, clazz, node, (Bindable) collection, jt); } else { join = new CollectionJoinImpl<X, Y>(this, metamodel.managedType(clazz), this.metamodel, clazz, node, (Bindable) collection, jt); } this.joins.add(join); ((FromImpl)join).isJoin = true; return join; }
/** * This clumsy code is just to get the class of plural attribute mapping * * @param et * @param fieldName * @return */ private Class<?> getPluralJavaType(EntityType<?> et, String fieldName) { for (PluralAttribute<?,?,?> pa : et.getPluralAttributes()) { if (pa.getName().equals(fieldName)) { switch (pa.getCollectionType()) { case COLLECTION: return et.getCollection(fieldName).getElementType().getJavaType(); case LIST: return et.getList(fieldName).getElementType().getJavaType(); case SET: return et.getSet(fieldName).getElementType().getJavaType(); case MAP: throw new UnsupportedOperationException("Entity Map mapping unsupported for entity: " + et.getName() + " field name: " + fieldName); } } } throw new IllegalArgumentException("Field " + fieldName + " of entity " + et.getName() + " is not a plural attribute"); }
/** * {@inheritDoc} * */ @Override @SuppressWarnings("unchecked") public <Y> CollectionJoinImpl<X, Y> join(CollectionAttribute<? super X, Y> collection, JoinType jt) { return (CollectionJoinImpl<X, Y>) this.join(collection.getName(), jt); }
.getAnnotation(ManyToMany.class) != null) { CollectionAttribute<?, ?> ca = (CollectionAttribute<?, ?>) att2; if (ca.getElementType().equals( jpaEntityType)) { other = ca;
/** * {@inheritDoc} * */ @Override @SuppressWarnings("unchecked") public <Y> CollectionJoinImpl<X, Y> join(CollectionAttribute<? super X, Y> collection, JoinType jt) { return (CollectionJoinImpl<X, Y>) this.join(collection.getName(), jt); }
private <Y> CollectionJoinImplementor<X, Y> constructJoin(CollectionAttribute<? super X, Y> collection, JoinType jt) { if ( jt.equals( JoinType.RIGHT ) ) { throw new UnsupportedOperationException( "RIGHT JOIN not supported" ); } // TODO : runtime check that the attribute in fact belongs to this From's model/bindable final Class<Y> attributeType = collection.getBindableJavaType(); return new CollectionAttributeJoin<X, Y>( criteriaBuilder(), attributeType, this, collection, jt ); }
private <Y> CollectionAttributeJoin<X, Y> constructJoin(CollectionAttribute<? super X, Y> collection, String alias, JoinType jt) { checkJoin(collection, jt); final Class<Y> attributeType = collection.getBindableJavaType(); CollectionAttributeJoin<X, Y> join = new CollectionAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, collection, jt); join.setAlias(alias); return join; }
private <Y> CollectionAttributeJoin<X, Y> constructJoin(CollectionAttribute<? super X, Y> collection, String alias, JoinType jt) { checkJoin(collection, jt); final Class<Y> attributeType = collection.getBindableJavaType(); CollectionAttributeJoin<X, Y> join = new CollectionAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, collection, jt); join.setAlias(alias); return join; }
/** * Correlates a join to a Collection-valued association or element * collection in the enclosing query to a join object of the subquery and * returns the subquery join object. * * @param parentCollection * join target of the containing query * @return subquery join */ public <X, Y> CollectionJoin<X, Y> correlate(CollectionJoin<X, Y> parentCollection){ this.correlatedJoins.add(parentCollection); return new CollectionJoinImpl(parentCollection.getParentPath(), metamodel.managedType(parentCollection.getModel().getBindableJavaType()), metamodel, parentCollection.getJavaType(), internalCorrelate((FromImpl) parentCollection), parentCollection.getModel(), parentCollection.getJoinType(), (FromImpl) parentCollection); }