private static boolean isAssociation(Attribute<?, ?> attribute) { return ASSOCIATION_TYPES.contains(attribute.getPersistentAttributeType()); }
if (!ASSOCIATION_TYPES.containsKey(attribute.getPersistentAttributeType())) { return false; Class<? extends Annotation> associationAnnotation = ASSOCIATION_TYPES.get(attribute.getPersistentAttributeType());
attribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.EMBEDDED || attribute.getDeclaringType().getPersistenceType() == Type.PersistenceType.EMBEDDABLE;
private DefaultPath(PathType pathType, ManagedType<X> managedType, Attribute<X, ?> attribute, EntityType<X> entityType,Attribute embeddedAttribute) { this.pathType = pathType; this.managedType = managedType; this.attribute = attribute; this.entityType = entityType; if(embeddedAttribute != null && embeddedAttribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) { this.embeddedAttribute =embeddedAttribute; } }
@Override public <Y> Path<Y> get(String paramString) { Attribute attribute = null; if (this.attribute != null && this.attribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) { try { DefaultEmbeddableType embeddableType = (DefaultEmbeddableType) ((DefaultSingularAttribute) this.attribute) .getType(); attribute = embeddableType.getAttribute(paramString); } catch (IllegalArgumentException iaex) { // do nothing. ignore } } attribute = attribute == null ? this.managedType.getAttribute(paramString) : attribute; // TODO:: need to check for illegalStateException. return cache.get(attribute, this.entityType, this.attribute); }
if (attrib.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED) || attrib.getPersistentAttributeType().equals(PersistentAttributeType.ELEMENT_COLLECTION)) else if (attrib.getPersistentAttributeType().equals(PersistentAttributeType.BASIC))
@Override public boolean isElementCollection(Attribute<?, ?> attribute) { return attribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.ELEMENT_COLLECTION; } }
@Override public boolean isElementCollection(Attribute<?, ?> attribute) { return attribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.ELEMENT_COLLECTION; } }
protected final boolean isManagedType(Attribute<?,?> attribute) { return attribute.getPersistentAttributeType() != PersistentAttributeType.EMBEDDED && attribute.getPersistentAttributeType() != PersistentAttributeType.BASIC && attribute.getPersistentAttributeType() != PersistentAttributeType.ELEMENT_COLLECTION; }
.getAttribute("association"); Assert.assertNotNull(associationAttribute); Assert.assertEquals(PersistentAttributeType.ONE_TO_ONE, associationAttribute.getPersistentAttributeType()); Assert.assertEquals(AssociationEntity.class, associationAttribute.getJavaType()); Assert.assertEquals(true, associationAttribute.isAssociation());
.getAttribute("association"); Assert.assertNotNull(associationAttribute); Assert.assertEquals(PersistentAttributeType.ONE_TO_ONE, associationAttribute.getPersistentAttributeType()); Assert.assertEquals(AssociationBiEntity.class, associationAttribute.getJavaType()); Assert.assertEquals(true, associationAttribute.isAssociation()); Assert.assertEquals(PersistentAttributeType.ONE_TO_ONE, ownerAttribute.getPersistentAttributeType()); Assert.assertEquals(OToOOwnerBiEntity.class, ownerAttribute.getJavaType()); Assert.assertEquals(true, ownerAttribute.isAssociation());
.getAttribute("association"); Assert.assertNotNull(associationAttribute); Assert.assertEquals(PersistentAttributeType.ONE_TO_MANY, associationAttribute.getPersistentAttributeType()); Assert.assertEquals(Collection.class, associationAttribute.getJavaType()); Assert.assertEquals(AssociationEntity.class, ((Bindable) associationAttribute).getBindableJavaType());
@Override public boolean isJoinable(Attribute<?, ?> attr) { return attr.isCollection() || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE; }
@Override public boolean isJoinable(Attribute<?, ?> attr) { return attr.isCollection() || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE; }
private boolean isAttributeSingularManagedType(Attribute<?, ?> attribute) { if (PersistentAttributeType.EMBEDDED.equals(attribute.getPersistentAttributeType()) || PersistentAttributeType.MANY_TO_ONE.equals(attribute.getPersistentAttributeType()) || PersistentAttributeType.ONE_TO_ONE.equals(attribute.getPersistentAttributeType())) { return true; } return false; } }
/** * Verify if a property is an Embedded type. * * @param property Property to verify. * @param classMetadata Metamodel of the class we want to check. * @return <tt>true</tt> if the property is an embedded attribute, <tt>false</tt> otherwise. */ private static <T> boolean isEmbeddedType(String property, ManagedType<T> classMetadata){ return classMetadata.getAttribute(property).getPersistentAttributeType() == PersistentAttributeType.EMBEDDED; }
@Override void determineStructuredType() { if (jpaAttribute.getPersistentAttributeType() == PersistentAttributeType.EMBEDDED) type = schema.getStructuredType(jpaAttribute); else type = null; }
private JoinType getModelAwareType(JoinNode baseNode, Attribute<?, ?> attr) { if (baseNode.getJoinType() == JoinType.LEFT) { return JoinType.LEFT; } if ((attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE) && ((SingularAttribute<?, ?>) attr).isOptional() == false) { return JoinType.INNER; } else { return JoinType.LEFT; } }
@Override public boolean isCompositeNode(Attribute<?, ?> attr) { if (attr.isCollection()) { PluralAttribute<?, ?, ?> pluralAttribute = (PluralAttribute<?, ?, ?>) attr; if (pluralAttribute.getElementType().getPersistenceType() == Type.PersistenceType.BASIC) { return false; } return true; } return attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE; }
@Override public boolean isCompositeNode(Attribute<?, ?> attr) { if (attr.isCollection()) { PluralAttribute<?, ?, ?> pluralAttribute = (PluralAttribute<?, ?, ?>) attr; if (pluralAttribute.getElementType().getPersistenceType() == Type.PersistenceType.BASIC) { return false; } return true; } return attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE; }