@Override protected Attribute locateAttributeInternal(String attributeName) { final Attribute attribute = managedType.getAttribute( attributeName ); // ManagedType.locateAttribute should throw exception rather than return // null, but just to be safe... if ( attribute == null ) { throw new IllegalArgumentException( "Could not resolve attribute named " + attributeName ); } return attribute; }
@Override @SuppressWarnings({"unchecked"}) protected Attribute<X, ?> locateAttributeInternal(String name) { return (Attribute<X, ?>) locateManagedType().getAttribute( name ); }
ManagedType mt = mm.managedType(clazz); try { Attribute attr = mt.getAttribute(piece); if (attr != null) { Root additionalRoot = criteria.from(clazz);
@SuppressWarnings("unchecked") static <T> Expression<T> toExpressionRecursively(From<?, ?> from, PropertyPath property, boolean isForSelection) { Bindable<?> propertyPathModel; Bindable<?> model = from.getModel(); String segment = property.getSegment(); if (model instanceof ManagedType) { /* * Required to keep support for EclipseLink 2.4.x. TODO: Remove once we drop that (probably Dijkstra M1) * See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=413892 */ propertyPathModel = (Bindable<?>) ((ManagedType<?>) model).getAttribute(segment); } else { propertyPathModel = from.get(segment).getModel(); } if (requiresJoin(propertyPathModel, model instanceof PluralAttribute, !property.hasNext(), isForSelection) && !isAlreadyFetched(from, segment)) { Join<?, ?> join = getOrCreateJoin(from, segment); return (Expression<T>) (property.hasNext() ? toExpressionRecursively(join, property.next(), isForSelection) : join); } else { Path<Object> path = from.get(segment); return (Expression<T>) (property.hasNext() ? toExpressionRecursively(path, property.next()) : path); } }
@Override public Attribute<? super X, ?> getAttribute(String paramName) { Attribute<? super X, ?> attribute = getDeclaredAttribute(paramName, false); if (attribute == null && superClazzType != null) { attribute = superClazzType.getAttribute(paramName); } checkForValid(paramName, attribute); return attribute; }
@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); }
public static <T> Attribute<? super T, ?> getAttribute(ManagedType<T> type, String attributeName) { try { return type.getAttribute(attributeName); } catch (IllegalArgumentException ex) { return null; } }
public static <T> Attribute<? super T, ?> getAttribute(ManagedType<T> type, String attributeName) { try { return type.getAttribute(attributeName); } catch (IllegalArgumentException ex) { return null; } }
@Override protected Attribute locateAttributeInternal(String attributeName) { final Attribute attribute = managedType.getAttribute( attributeName ); // ManagedType.locateAttribute should throw exception rather than return // null, but just to be safe... if ( attribute == null ) { throw new IllegalArgumentException( "Could not resolve attribute named " + attributeName ); } return attribute; } }
@Override protected Attribute<?, ?> findAttribute(String attributeName) { final Attribute<?, ?> attribute = managedType.getAttribute(attributeName); // Some old hibernate versions don't throw an exception but return null if (attribute == null) { throw new IllegalArgumentException("Could not resolve attribute named: " + attributeName); } return attribute; }
@Override @SuppressWarnings({ "unchecked" }) protected Attribute<X, ?> locateAttributeInternal(String name) { return (Attribute<X, ?>) locateManagedType().getAttribute( name ); }
@Override @SuppressWarnings({"unchecked"}) protected Attribute<X, ?> findAttribute(String name) { return (Attribute<X, ?>) getManagedType().getAttribute(name); }
@Override @SuppressWarnings({"unchecked"}) protected Attribute<X, ?> findAttribute(String name) { return (Attribute<X, ?>) getManagedType().getAttribute(name); }
public <X,Y> Fetch<X, Y> fetch(String name, JoinType jt) { assertJoinable(type); Attribute<? super X,?> attr = ((ManagedType<X>)type).getAttribute(name); if (attr.isCollection()) { return fetch((PluralAttribute)attr, jt); } else { return fetch(((SingularAttribute)attr), jt); } }
public <X,Y> Fetch<X, Y> fetch(String name, JoinType jt) { assertJoinable(type); Attribute<? super X,?> attr = ((ManagedType<X>)type).getAttribute(name); if (attr.isCollection()) { return fetch((PluralAttribute)attr, jt); } else { return fetch(((SingularAttribute)attr), jt); } }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }
/** * Gets a new path that represents the given single-valued attribute from this path. */ public <Y> Path<Y> get(SingularAttribute<? super X, Y> attr) { if (getType() != attr.getDeclaringType()) { attr = (SingularAttribute)((ManagedType)getType()).getAttribute(attr.getName()); } return new PathImpl<X,Y>(this, (Members.SingularAttributeImpl<? super X, Y>)attr, attr.getJavaType()); }
/** * Gets a new path that represents the given single-valued attribute from this path. */ public <Y> Path<Y> get(SingularAttribute<? super X, Y> attr) { if (getType() != attr.getDeclaringType()) { attr = (SingularAttribute)((ManagedType)getType()).getAttribute(attr.getName()); } return new PathImpl<X,Y>(this, (Members.SingularAttributeImpl<? super X, Y>)attr, attr.getJavaType()); }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }