@Override public ExpressionList<T> where() { return query.where(); }
@Override public ExpressionList<T> where() { return rootQuery.where(); }
/** * Return a list of expressions that will be joined by AND's. */ @Override public <T> Junction<T> conjunction(Query<T> query) { return new JunctionExpression<>(Junction.Type.AND, query, query.where()); }
/** * Return a list of expressions that will be joined by OR's. */ @Override public <T> Junction<T> disjunction(Query<T> query) { return new JunctionExpression<>(Junction.Type.OR, query, query.where()); }
/** * Return a list of expressions that are wrapped by NOT. */ public <T> Junction<T> junction(Junction.Type type, Query<T> query) { return new JunctionExpression<>(type, query, query.where()); }
@Override public void addInheritanceWhere(Query<?> query) { if (inheritInfo != null && !inheritInfo.isRoot()) { query.where().eq(inheritInfo.getDiscriminatorColumn(), inheritInfo.getDiscriminatorValue()); } }
/** * Fetch the destination beans that will be published to. */ void fetchDestinationBeans(List<T> sourceBeans, boolean asDraft) { List<Object> ids = getBeanIds(desc, sourceBeans); Query<T> destQuery = server.find(desc.getBeanType()).where().idIn(ids).query(); if (asDraft) { destQuery.asDraft(); } desc.draftQueryOptimise(destQuery); this.destBeans = server.findMap(destQuery, transaction); }
/** * Returns a set of properties if saving the bean will violate the unique constraints (defined by given properties). */ private Set<Property> checkUniqueness(EntityBean entityBean, BeanDescriptor<?> beanDesc, BeanProperty[] props, Transaction transaction) { BeanProperty idProperty = beanDesc.getIdProperty(); Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory); ExpressionList<?> exprList = query.where(); if (!entityBean._ebean_getIntercept().isNew()) { // if model is not new, exclude ourself. exprList.ne(idProperty.getName(), idProperty.getVal(entityBean)); } for (Property prop : props) { Object value = prop.getVal(entityBean); if (value == null) { return null; } exprList.eq(prop.getName(), value); } if (findCount(query, transaction) > 0) { Set<Property> ret = new LinkedHashSet<>(); Collections.addAll(ret, props); return ret; } return null; }
/** * Return the expression list that has been built for this query. */ @Nonnull public ExpressionList<T> getExpressionList() { return query.where(); }
/** * Return a list of expressions that will be joined by AND's. */ @Override public <T> Junction<T> conjunction(Query<T> query) { return new JunctionExpression<>(Junction.Type.AND, query, query.where()); }
/** * Return a list of expressions that will be joined by OR's. */ @Override public <T> Junction<T> disjunction(Query<T> query) { return new JunctionExpression<>(Junction.Type.OR, query, query.where()); }
@Override public Optional<T> findByProperty(String fetchPath, String propertyName, Object propertyValue) { Assert.notNull(propertyName, PROP_MUST_NOT_BE_NULL); return query(fetchPath) .where() .eq(propertyName, propertyValue) .findOneOrEmpty(); }
@Override public boolean existsById(ID id) { Assert.notNull(id, ID_MUST_NOT_BE_NULL); return query().where().idEq(id).findCount() > 0; }
@Override public List<T> findAll(String fetchPath, Iterable<ID> ids) { Assert.notNull(ids, "The given Iterable of Id's must not be null!"); return query(fetchPath) .where() .idIn((Collection<?>) ids) .findList(); }
q.where().idIn(idList); if (t.isLogSummary()) { t.logSummary("-- DeleteById of " + descriptor.getName() + " ids[" + idList + "] requires fetch of foreign key values"); q.where().idEq(id); if (t.isLogSummary()) { t.logSummary("-- DeleteById of " + descriptor.getName() + " id[" + id + "] requires fetch of foreign key values");
@Override public void addInheritanceWhere(Query<?> query) { if (inheritInfo != null && !inheritInfo.isRoot()) { query.where().eq(inheritInfo.getDiscriminatorColumn(), inheritInfo.getDiscriminatorValue()); } }