@SuppressWarnings("unchecked")
public <E, F> Path<F> getPath(Root<E> root, List<Attribute<?, ?>> attributes) {
Path<?> path = root;
for (Attribute<?, ?> attribute : attributes) {
boolean found = false;
if (path instanceof FetchParent) {
for (Fetch<E, ?> fetch : ((FetchParent<?, E>) path).getFetches()) {
if (attribute.getName().equals(fetch.getAttribute().getName()) && (fetch instanceof Join<?, ?>)) {
path = (Join<E, ?>) fetch;
found = true;
break;
}
}
}
if (!found) {
if ((attributes.indexOf(attribute) != (attributes.size() - 1)) && (attribute instanceof Bindable)
&& Identifiable.class.isAssignableFrom(((Bindable<?>) attribute).getBindableJavaType()) && (path instanceof From)) {
path = ((From<?, ?>) path).join(attribute.getName(), JoinType.LEFT);
} else {
path = path.get(attribute.getName());
}
}
}
return (Path<F>) path;
}
JpaUtil.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:jpasearch
作者:
评论列表
文章目录