if (attribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) {
if (attribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) {
.equals(Attribute.PersistentAttributeType.BASIC)) { continue;
case MANY_TO_ONE: if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) { addForeignKey(currentAttribute); if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) {
case MANY_TO_ONE: if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) { addForeignKey(currentAttribute); if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) {
/** * Return the path corresponding to the referenced non-collection valued * attribute. * * @param model * attribute * @return path corresponding to the referenced attribute */ public <Y> Path<Y> get(SingularAttribute<? super X, Y> att){ if (att.getPersistentAttributeType().equals(PersistentAttributeType.BASIC)){ return new PathImpl<Y>(this, this.metamodel, att.getBindableJavaType(),this.currentNode.get(att.getName()), att); }else{ Class<Y> clazz = att.getBindableJavaType(); Join join = new JoinImpl<X, Y>(this, this.metamodel.managedType(clazz), this.metamodel, clazz,this.currentNode.get(att.getName()), att); this.joins.add(join); return join; } }
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; } }
@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); }
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; } }
public boolean isAssociation() { return persistenceAttribType.equals(PersistentAttributeType.MANY_TO_MANY) || persistenceAttribType.equals(PersistentAttributeType.MANY_TO_ONE) || persistenceAttribType.equals(PersistentAttributeType.ONE_TO_MANY) || persistenceAttribType.equals(PersistentAttributeType.ONE_TO_ONE); }