本文整理了Java中javax.persistence.criteria.Root.getFetches
方法的一些代码示例,展示了Root.getFetches
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Root.getFetches
方法的具体详情如下:
包路径:javax.persistence.criteria.Root
类名称:Root
方法名:getFetches
暂无
代码示例来源:origin: hibernate/hibernate-orm
renderFetches( jpaqlQuery, renderingContext, root.getFetches() );
代码示例来源:origin: org.omnifaces/omnipersistence
@Override
public Set<Fetch<X, ?>> getFetches() {
return getWrapped().getFetches();
}
代码示例来源:origin: org.apache.openejb.patch/openjpa
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) {
List<String> iPaths = new ArrayList<String>();
List<String> oPaths = new ArrayList<String>();
Set<Root<?>> roots = q.getRoots();
for (Root root : roots) {
Set<Fetch> fetches = root.getFetches();
if (fetches == null)
continue;
for (Fetch<?,?> fetch : fetches) {
String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false);
oPaths.add(fPath);
if (fetch.getJoinType() == JoinType.INNER) {
iPaths.add(fPath);
}
}
}
if (!iPaths.isEmpty()) {
exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]);
}
if (!oPaths.isEmpty()) {
exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]);
}
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence
private void renderRoots(StringBuilder buffer, Collection<Root<?>> roots) {
if (roots == null) return;
int i = 0;
for (Root r : roots) {
buffer.append(((ExpressionImpl<?>)r).asVariable(this));
if (++i != roots.size()) buffer.append(", ");
renderJoins(buffer, r.getJoins());
renderFetches(buffer, r.getFetches());
}
}
private void renderFetches(StringBuilder buffer, Set<Fetch> fetches) {
代码示例来源:origin: org.apache.openjpa/openjpa-all
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) {
List<String> iPaths = new ArrayList<String>();
List<String> oPaths = new ArrayList<String>();
Set<Root<?>> roots = q.getRoots();
for (Root root : roots) {
Set<Fetch> fetches = root.getFetches();
if (fetches == null)
continue;
for (Fetch<?,?> fetch : fetches) {
String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false);
oPaths.add(fPath);
if (fetch.getJoinType() == JoinType.INNER) {
iPaths.add(fPath);
}
}
}
if (!iPaths.isEmpty()) {
exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]);
}
if (!oPaths.isEmpty()) {
exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]);
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-persistence
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) {
List<String> iPaths = new ArrayList<String>();
List<String> oPaths = new ArrayList<String>();
Set<Root<?>> roots = q.getRoots();
for (Root root : roots) {
Set<Fetch> fetches = root.getFetches();
if (fetches == null)
continue;
for (Fetch<?,?> fetch : fetches) {
String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false);
oPaths.add(fPath);
if (fetch.getJoinType() == JoinType.INNER) {
iPaths.add(fPath);
}
}
}
if (!iPaths.isEmpty()) {
exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]);
}
if (!oPaths.isEmpty()) {
exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]);
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
private void renderRoots(StringBuilder buffer, Collection<Root<?>> roots) {
if (roots == null) return;
int i = 0;
for (Root r : roots) {
buffer.append(((ExpressionImpl<?>)r).asVariable(this));
if (++i != roots.size()) buffer.append(", ");
renderJoins(buffer, r.getJoins());
renderFetches(buffer, r.getFetches());
}
}
private void renderFetches(StringBuilder buffer, Set<Fetch> fetches) {
代码示例来源:origin: org.apache.openjpa/openjpa-persistence
private void renderRoots(StringBuilder buffer, Collection<Root<?>> roots) {
if (roots == null) return;
int i = 0;
for (Root r : roots) {
buffer.append(((ExpressionImpl<?>)r).asVariable(this));
if (++i != roots.size()) buffer.append(", ");
renderJoins(buffer, r.getJoins());
renderFetches(buffer, r.getFetches());
}
}
private void renderFetches(StringBuilder buffer, Set<Fetch> fetches) {
代码示例来源:origin: org.apache.openejb.patch/openjpa
private void renderRoots(StringBuilder buffer, Collection<Root<?>> roots) {
if (roots == null) return;
int i = 0;
for (Root r : roots) {
buffer.append(((ExpressionImpl<?>)r).asVariable(this));
if (++i != roots.size()) buffer.append(", ");
renderJoins(buffer, r.getJoins());
renderFetches(buffer, r.getFetches());
}
}
private void renderFetches(StringBuilder buffer, Set<Fetch> fetches) {
代码示例来源:origin: br.eti.clairton/repository
public Long count(final Boolean distinct) {
final Expression<?> from = selections.isEmpty() ? this.from : (Expression<?>) selections.get(0);
@SuppressWarnings("unchecked")
final Set<Fetch<?, ?>> fetches = (Set<Fetch<?, ?>>)((Set<?>) this.from.getFetches());
fetchToJoin(this.from, fetches);
final Expression<?> s;
if (distinct) {
s = builder.countDistinct(from);
} else {
s = builder.count(from);
}
final List<Expression<?>> selections = new ArrayList<>();
selections.add(s);
final TypedQuery<Long> query = query(selections, criteriaQuery, predicates, new ArrayList<javax.persistence.criteria.Order>());
final Long count = (Long) query.getResultList().get(0);
filtersClears();
return count;
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) {
List<String> iPaths = new ArrayList<String>();
List<String> oPaths = new ArrayList<String>();
Set<Root<?>> roots = q.getRoots();
for (Root root : roots) {
Set<Fetch> fetches = root.getFetches();
if (fetches == null)
continue;
for (Fetch<?,?> fetch : fetches) {
String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false);
oPaths.add(fPath);
if (fetch.getJoinType() == JoinType.INNER) {
iPaths.add(fPath);
}
}
}
if (!iPaths.isEmpty()) {
exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]);
}
if (!oPaths.isEmpty()) {
exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]);
}
}
代码示例来源:origin: katharsis-project/katharsis-framework
public static boolean hasManyRootsFetchesOrJoins(CriteriaQuery<?> criteriaQuery) {
Set<Root<?>> roots = criteriaQuery.getRoots();
// more than one root, user is supposed to handle this manually
if (roots.size() != 1)
return false;
for (Root<?> root : roots) {
if (containsMultiRelationFetch(root.getFetches()))
return true;
if (containsMultiRelationJoin(root.getJoins()))
return true;
}
return false;
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence
protected void evalAccessPaths(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) {
Set<ClassMetaData> metas = new HashSet<ClassMetaData>();
MetamodelImpl metamodel = q.getMetamodel();
for (Root<?> root : q.getRoots()) {
metas.add(((AbstractManagedType<?>)root.getModel()).meta);
for (Join<?,?> join : root.getJoins()) {
Class<?> cls = join.getAttribute().getJavaType();
if (join.getAttribute().isAssociation()) {
ClassMetaData meta = metamodel.getRepository().getMetaData(cls, null, true);
PersistenceType type = MetamodelImpl.getPersistenceType(meta);
if (type == PersistenceType.ENTITY || type == PersistenceType.EMBEDDABLE)
metas.add(meta);
}
}
for (Fetch<?,?> fetch : root.getFetches()) {
metas.add(metamodel.getRepository().getCachedMetaData(fetch.getAttribute().getJavaType()));
}
}
exps.accessPath = metas.toArray(new ClassMetaData[metas.size()]);
}
代码示例来源:origin: org.apache.openejb.patch/openjpa
protected void evalAccessPaths(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) {
Set<ClassMetaData> metas = new HashSet<ClassMetaData>();
MetamodelImpl metamodel = q.getMetamodel();
for (Root<?> root : q.getRoots()) {
metas.add(((AbstractManagedType<?>)root.getModel()).meta);
for (Join<?,?> join : root.getJoins()) {
Class<?> cls = join.getAttribute().getJavaType();
if (join.getAttribute().isAssociation()) {
ClassMetaData meta = metamodel.getRepository().getMetaData(cls, null, true);
PersistenceType type = MetamodelImpl.getPersistenceType(meta);
if (type == PersistenceType.ENTITY || type == PersistenceType.EMBEDDABLE)
metas.add(meta);
}
}
for (Fetch<?,?> fetch : root.getFetches()) {
metas.add(metamodel.getRepository().getCachedMetaData(fetch.getAttribute().getJavaType()));
}
}
exps.accessPath = metas.toArray(new ClassMetaData[metas.size()]);
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb
renderFetches( jpaqlQuery, renderingContext, root.getFetches() );
内容来源于网络,如有侵权,请联系作者删除!