本文整理了Java中javax.persistence.criteria.Path.getParentPath()
方法的一些代码示例,展示了Path.getParentPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.getParentPath()
方法的具体详情如下:
包路径:javax.persistence.criteria.Path
类名称:Path
方法名:getParentPath
[英]Return the parent "node" in the path or null if no parent.
[中]返回路径中的父节点,如果没有父节点,则返回null。
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public Predicate buildPredicate(CriteriaBuilder builder,
FieldPathBuilder fieldPathBuilder, From root,
String ceilingEntity,
String fullPropertyName, Path explicitPath,
List directValues) {
//expect it to be allParentCategoryXrefs.category.name, so we need to restrict on allParentCategoryXrefs - 2 levels up
Predicate equal = builder.equal(explicitPath.getParentPath().getParentPath().get("defaultReference"), Boolean.TRUE);
return equal;
}
})
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
if (path.getParentPath() != null && path.getParentPath().getJavaType().isAnnotationPresent(Embeddable.class) && path instanceof PluralAttributePath) {
代码示例来源:origin: babyfish-ct/babyfish
private void pathMustBeChildOfRoot(Path<?> attribute) {
Arguments.mustBeInstanceOfValue("attribute.getModel()", attribute.getModel(), SingularAttribute.class);
for (Path<?> parent = attribute.getParentPath(); parent != null; parent = parent.getParentPath()) {
if (parent == this.root) {
return;
}
}
throw new IllegalArgumentException(pathMustBeChildOfRoot(this.getClass()));
}
代码示例来源:origin: org.fornax.cartridges/fornax-cartridges-sculptor-framework
private Join<?,?> getExplicitJoinForPath(Path<?> path, String property) {
Path<?> parentPath = path.getParentPath();
if (From.class.isAssignableFrom(parentPath.getClass())) {
return ((From<?,?>)parentPath).join(property);
}
throw new QueryConfigException("Can't create a explicit join for property " + property);
}
代码示例来源:origin: babyfish-ct/babyfish
@Override
public void visitPath(Path<?> path) {
if (path instanceof MapKeyPath<?>) {
this.visit(path.getParentPath());
} else {
PathId pathId = QueryContext.this.pathIdAllocator.allocate();
if (pathId.getPath() != path) {
throw new AssertionError();
}
this.pathNodeImpls.put(pathId, null);
}
}
代码示例来源:origin: babyfish-ct/babyfish
@Override
public void visitPath(Path<?> path) {
StringBuilder jpqlBuilder = this.jpqlBuilder;
if (path instanceof MapKeyPath<?>) {
jpqlBuilder.append("key(");
this.visit(path.getParentPath());
jpqlBuilder.append(')');
} else {
PathId pathId = this.pathIdAllocator.allocate();
if (pathId.getPath() != path) {
throw new AssertionError();
}
PathNode pathNode = this.queryContext.getPathNodes().get(pathId);
if (pathNode == null) {
throw new AssertionError();
}
this.renderPathNode(pathNode);
}
}
代码示例来源:origin: katharsis-project/katharsis-framework
public static boolean containsRelation(Object expr) {
if (expr instanceof Join) {
return true;
}
else if (expr instanceof SingularAttribute) {
SingularAttribute<?, ?> attr = (SingularAttribute<?, ?>) expr;
return attr.isAssociation();
}
else if (expr instanceof Path) {
Path<?> attrPath = (Path<?>) expr;
Bindable<?> model = attrPath.getModel();
Path<?> parent = attrPath.getParentPath();
return containsRelation(parent) || containsRelation(model);
}
else {
// we may can do better here...
return false;
}
}
代码示例来源:origin: babyfish-ct/babyfish
private ToStringVisitorImpl renderPath(Path<?> path) {
if (path instanceof MapKeyPath<?>) {
this.append("key(");
this.renderPath(path.getParentPath());
this.append(")");
} else if (path instanceof FetchParent<?, ?>) {
this.append(fetchParentId((FetchParent<?, ?>)path));
} else {
if (path.getParentPath() != null) {
this.renderPath(path.getParentPath()).append(".");
}
else if (path instanceof PluralAttributePath<?>){
this.append(((PluralAttributePath<?>)path).getAttribute().getName());
} else {
this.append(((SingularAttributePath<?>)path).getAttribute().getName());
}
}
return this;
}
代码示例来源:origin: br.com.perolasoftware.framework.components/annotation-filter-jpa2
currentEntity = currentEntity.get(attributes[index]);
} else if (currentEntity.getJavaType().isAnnotationPresent(Embeddable.class) &&
currentEntity.getParentPath().getJavaType().getDeclaredField(attributes[index-1]).isAnnotationPresent(EmbeddedId.class)) {
currentEntity = currentEntity.get(attributes[index]);
} else if (ReflectionUtil.getDeclaredField(currentEntity.getJavaType(), attributes[index]).isAnnotationPresent(Embeddable.class)) {
代码示例来源:origin: babyfish-ct/babyfish
dbSchemaStrict,
false,
path.getParentPath(),
fromEntityImplMap,
directlyReferencedByTopmostSelection),
SingularAttribute<?, ?> attribute = (SingularAttribute<?, ?>)path.getModel();
if (attribute.isId()) {
if (path.getParentPath() instanceof Join<?, ?>) {
Join<?, ?> join = (Join<?, ?>)path.getParentPath();
if (isLeftOrNonNullReferenceJoin(join, dbSchemaStrict)) {
From<?, ?> from = (From<?, ?>)join.getParentPath();
} else if (path.getParentPath() instanceof SingularAttributePath<?>) {
SingularAttributePath<?> parentPath = (SingularAttributePath<?>)path.getParentPath();
return
new PathNodeImpl(
dbSchemaStrict,
false,
path.getParentPath(),
fromEntityImplMap,
directlyReferencedByTopmostSelection);
dbSchemaStrict,
false,
path.getParentPath(),
内容来源于网络,如有侵权,请联系作者删除!