public static Predicate hasTissue(final String cvTerm) { QPeptide peptide = QPeptide.peptide; return peptide.tissues.any().cvTerm.eq(cvTerm); }
@Override public <E> Path<Collection<E>> createCollectionPath(Class<E> elementType, PathMetadata<?> metadata) { return new CollectionPath<E,EntityPathBase<E>>(elementType, (Class)EntityPathBase.class, metadata); }
@Override public Q any() { if (any == null) { any = newInstance(queryType, PathMetadataFactory.forCollectionAny(pathMixin)); } return any; }
@Test @NoHibernate // https://hibernate.atlassian.net/browse/HHH-6686 public void IsEmpty_ElementCollection() { QEmployee employee = QEmployee.employee; query().from(employee).where(employee.jobFunctions.isEmpty()).count(); }
@Test @NoBatooJPA public void Enum_In2() { QEmployee employee = QEmployee.employee; JPQLQuery query = query(); query.from(employee).where(employee.lastName.eq("Smith"), employee.jobFunctions .contains(JobFunction.CODER)); assertEquals(1l, query.count()); }
public static Predicate hasTissue(final String cvTerm) { QProtein protein = QProtein.protein; return protein.tissues.any().cvTerm.eq(cvTerm); }
/** * Create a new Collection typed path * * @param <A> * @param property * @param type * @return */ @SuppressWarnings("unchecked") protected <A, Q extends SimpleExpression<? super A>> CollectionPath<A, Q> createCollection(String property, Class<? super A> type, Class<? super Q> queryType, PathInits inits) { return add(new CollectionPath<A, Q>(type, (Class) queryType, forProperty(property), inits)); }
public static Predicate hasModification(final String modId) { QProtein protein = QProtein.protein; return protein.modificationLocations.any().modId.eq(modId); }
public static Predicate hasModification(final String modId) { QPeptide peptide = QPeptide.peptide; return peptide.modificationLocations.any().modId.eq(modId); }
@Test public void Simple_BooleanOperation_ElementCollection() { QEmployee employee = QEmployee.employee; Predicate predicate = employee.jobFunctions.any().eq(JobFunction.CODER); assertMatches("exists \\(select 1\n" + "from Employee employee.*\n" + " inner join employee.*.jobFunctions as employee_jobFunctions.*\n" + "where employee.* = employee and employee_jobFunctions.* = \\?1\\)", serialize(predicate)); }
@Test @NoBatooJPA public void Any_In3() { QEmployee employee = QEmployee.employee; assertFalse(query().from(employee).where( employee.jobFunctions.any().in(JobFunction.CODER, JobFunction.CONSULTANT)) .list(employee).isEmpty()); }