Class<?> cteAttrType = attributeEntry.getElementClass();
attribute.getPersistentAttributeType() != Attribute.PersistentAttributeType.EMBEDDED && valuesNode.getQualificationExpression() == null) { ManagedType<?> managedAttributeType = mainQuery.metamodel.getManagedType(entry.getElementClass()); if (managedAttributeType == null || mainQuery.jpaProvider.needsElementCollectionIdCutoff() && valuesNode.getValuesLikeAttribute() != null && mapping.get(valuesNode.getValuesLikeAttribute()).getAttribute().getPersistentAttributeType() == Attribute.PersistentAttributeType.ELEMENT_COLLECTION) { sb.append("e");
if (attributeEntry.getElementClass() != baseExpression.getPathReference().getType().getJavaType()) { throw new IllegalStateException("An association should be bound to its association type and not its identifier type"); parameterManager.getParameter(parameterName).setTranformer(new SplittingParameterTransformer(parameterManager, metamodel, attributeEntry.getElementClass(), parameterAccessPaths));
if (valuesLikeAttribute.getAttributePath().size() > 1) { ExtendedAttribute<?, ?> superAttr = extendedManagedType.getAttribute(valuesLikeAttribute.getAttributePathString().substring(0, valuesLikeAttribute.getAttributePathString().lastIndexOf('.'))); elementClass = JpaMetamodelUtils.resolveKeyClass(superAttr.getElementClass(), (MapAttribute<?, ?, ?>) valuesLikeAttribute.getAttribute()); } else { elementClass = JpaMetamodelUtils.resolveKeyClass(entityBaseClass, (MapAttribute<?, ?, ?>) valuesLikeAttribute.getAttribute()); } else { valuesLikeAttribute = extendedManagedType.getAttribute(attributeName); elementClass = valuesLikeAttribute.getElementClass(); valuesLikeClause = ((EntityType<?>) extendedManagedType.getType()).getName() + "." + attributeName; qualificationExpression = null;
ExtendedAttribute<?, ?> extendedAttribute = extendedManagedType.getAttributes().get(iterator.next()); try { SingularAttribute<? super Object, ?> version = ((IdentifiableType<Object>) jpaManagedType).getVersion(extendedAttribute.getElementClass()); if (extendedAttribute.getAttributePathString().equals(version.getName())) { iterator.remove();
public AbstractUnmappedAttributeCascadeDeleter(EntityViewManagerImpl evm, String attributeName, ExtendedAttribute<?, ?> attribute) { EntityMetamodel entityMetamodel = evm.getMetamodel().getEntityMetamodel(); this.elementEntityClass = attribute.getElementClass(); this.attributeName = attributeName; if (entityMetamodel.getEntity(elementEntityClass) == null) { this.elementIdAttributeName = null; this.attributeValuePath = attributeName; this.cascadeDeleteElement = false; } else { ExtendedManagedType extendedManagedType = entityMetamodel.getManagedType(ExtendedManagedType.class, elementEntityClass); this.elementIdAttributeName = extendedManagedType.getIdAttribute().getName(); this.attributeValuePath = attributeName + "." + elementIdAttributeName; this.cascadeDeleteElement = attribute.isDeleteCascaded(); } }
attrPath.setPathReference(new SimplePathReference(rootNode, propertyPath, m.type(extendedAttribute.getElementClass()))); pathExpressions.add(attrPath);
ExtendedAttribute attributeEntry = entry.getValue(); JoinTable joinTable = attributeEntry.getJoinTable(); if (joinTable == null && !"".equals(attributeEntry.getMappedBy()) && (entityMetamodel.getEntity(attributeEntry.getElementClass()) == null || !attributeEntry.isDeleteCascaded())) { iterator.remove(); if (extendedAttribute.getAttribute().isCollection()) { if ("".equals(extendedAttribute.getMappedBy())) { ExtendedManagedType managedType = entityMetamodel.getManagedType(ExtendedManagedType.class, extendedAttribute.getElementClass()); deleter = new UnmappedWritableBasicAttributeSetNullCascadeDeleter(evm, managedType, extendedAttribute.getWritableMappedByMappings((EntityType<?>) managedType.getType())); } else { ExtendedManagedType managedType = entityMetamodel.getManagedType(ExtendedManagedType.class, extendedAttribute.getElementClass()); deleter = new UnmappedWritableBasicAttributeSetNullCascadeDeleter(evm, managedType, extendedAttribute.getWritableMappedByMappings((EntityType<?>) managedType.getType())); } else {
return managedType.getOwnedSingularAttributes().containsKey(maybeSingularAssociationName + "." + maybeSingularAssociationIdExpression) && associationAttribute != null && (contains(metamodel.getManagedType(ExtendedManagedType.class, associationAttribute.getElementClass()).getIdAttributes(), maybeSingularAssociationIdExpression) || mainQuery.jpaProvider.supportsSingleValuedAssociationNaturalIdExpressions()); } else { return managedType.getOwnedSingularAttributes().containsKey(fullAttributePath + "." + maybeSingularAssociationIdExpression) && associationAttribute != null && (contains(metamodel.getManagedType(ExtendedManagedType.class, associationAttribute.getElementClass()).getIdAttributes(), maybeSingularAssociationIdExpression) || mainQuery.jpaProvider.supportsSingleValuedAssociationNaturalIdExpressions()); } else { return !mainQuery.jpaProvider.needsElementCollectionIdCutoff() && managedType.getAttributes().containsKey(fullAttributePath + "." + maybeSingularAssociationIdExpression) && associationAttribute != null && (contains(metamodel.getManagedType(ExtendedManagedType.class, associationAttribute.getElementClass()).getIdAttributes(), maybeSingularAssociationIdExpression) || mainQuery.jpaProvider.supportsSingleValuedAssociationNaturalIdExpressions());
if (attribute == null && (index = this.mapping.indexOf('.')) != -1 && this.mapping.indexOf('(') == -1 && (attribute = managedType.getOwnedAttributes().get(this.mapping.substring(0, index))) != null && !StringUtils.isEmpty(attribute.getMappedBy())) { this.correlated = attribute.getElementClass(); this.correlationExpression = attribute.getMappedBy() + " IN __correlationAlias"; this.correlationResult = this.mapping.substring(index + 1); } else if (attribute != null && !StringUtils.isEmpty(attribute.getMappedBy())) { this.correlated = attribute.getElementClass(); this.correlationExpression = attribute.getMappedBy() + " IN __correlationAlias"; this.correlationResult = "";