expression = dateExpression .dayOfMonth() .eq(searchCal.get(Calendar.DAY_OF_MONTH)) .and(dateExpression.month().eq( searchCal.get(Calendar.MONTH) + 1)) .and(dateExpression.year().eq( searchCal.get(Calendar.YEAR))); expression = dateExpression .dayOfMonth() .eq(searchCal.get(Calendar.DAY_OF_MONTH)) .and(dateExpression.month().eq( searchCal.get(Calendar.MONTH) + 1));
expression = dateExpression .dayOfMonth() .eq(searchCal.get(Calendar.DAY_OF_MONTH)) .and(dateExpression.month().eq( searchCal.get(Calendar.MONTH) + 1)) .and(dateExpression.year().eq( searchCal.get(Calendar.YEAR))); expression = dateExpression .dayOfMonth() .eq(searchCal.get(Calendar.DAY_OF_MONTH)) .and(dateExpression.month().eq( searchCal.get(Calendar.MONTH) + 1));
@Test public void BasicOperations3() { assertToString( "cat.bodyWeight + kitten.bodyWeight = kitten.bodyWeight", cat.bodyWeight.add(kitten.bodyWeight).eq(kitten.bodyWeight)); }
@Test public void Enum_Ordinal() throws Exception { query.from(user); query.where(user.getEnum("gender", User.Gender.class).ordinal().eq(1)); assertEquals("SELECT * WHERE { ?user ?_c2 ?_c3 ; ?_c4 ?user_gender . ?user_gender ?_c6 ?user_gender_ordinal . FILTER(?user_gender_ordinal = ?_c8) }"); }
@Test public void IndexOf() { assertToString("(select count(cat) from Cat cat where locate(?1,cat.name)-1 = ?2)", sub().from(cat).where(cat.name.indexOf("a").eq(1)).count()); }
@Test public void Contains4() { QEmployee employee = QEmployee.employee; query().from(employee) .where( employee.jobFunctions.contains(JobFunction.CODER), employee.jobFunctions.contains(JobFunction.CONSULTANT), employee.jobFunctions.size().eq(2)) .list(employee); }
@Test public void SubQuery3() { QCat cat = QCat.cat; QCat other = new QCat("other"); query().from(cat) .where(cat.name.eq(new JPASubQuery().from(other) .where(other.name.indexOf("B").eq(0)) .unique(other.name))) .list(cat); }
@Test @NoEclipseLink @ExcludeIn({ORACLE, TERADATA}) public void JoinEmbeddable() { QBookVersion bookVersion = QBookVersion.bookVersion; QBookMark bookMark = QBookMark.bookMark; query().from(bookVersion) .join(bookVersion.definition.bookMarks, bookMark) .where( bookVersion.definition.bookMarks.size().eq(1), bookMark.page.eq(2357L).or(bookMark.page.eq(2356L))) .list(bookVersion); }