use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapNeq.
// DATAJDBC-318
@Test
public void shouldMapNeq() {
Criteria criteria = Criteria.where("name").not("foo");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" != ?[:name]");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapFrom.
// DATAJDBC-318
@Test
public void shouldMapFrom() {
Criteria criteria = //
Criteria.from(Criteria.where("name").is("Foo")).and(//
Criteria.where("name").is("Bar").or("age").lessThan(//
49));
assertThat(criteria.isEmpty()).isFalse();
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" = ?[:name] AND (person.\"NAME\" = ?[:name1] OR person.age < ?[:age])");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapIsIn.
// DATAJDBC-318
@Test
public void shouldMapIsIn() {
Criteria criteria = Criteria.where("name").in("a", "b", "c");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" IN (?[:name], ?[:name1], ?[:name2])");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapNestedGroup.
// DATAJDBC-318
@Test
public void shouldMapNestedGroup() {
Criteria initial = Criteria.empty();
Criteria criteria = //
initial.and(Criteria.where("name").is("Foo")).and(//
Criteria.where("name").is("Bar").or("age").lessThan(//
49).or(//
Criteria.where("name").not("Bar").and("age").greaterThan(//
49)));
assertThat(criteria.isEmpty()).isFalse();
Condition condition = map(criteria);
assertThat(condition).hasToString("(person.\"NAME\" = ?[:name]) AND (person.\"NAME\" = ?[:name1] OR person.age < ?[:age] OR (person.\"NAME\" != ?[:name2] AND person.age > ?[:age1]))");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapBetween.
// DATAJDBC-318
@Test
public void shouldMapBetween() {
Criteria criteria = Criteria.where("name").between("a", "b");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" BETWEEN ?[:name] AND ?[:name1]");
}
Aggregations