use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapAndOrCriteria.
// DATAJDBC-318
@Test
public void shouldMapAndOrCriteria() {
Criteria criteria = //
Criteria.where("name").is("foo").and("name").isNotNull().or("bar").is(//
"baz").and("anotherOne").is("alternative");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" = ?[:name] AND person.\"NAME\" IS NOT NULL OR person.bar = ?[:bar] AND person.anotherOne = ?[:anotherOne]");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapIsNull.
// DATAJDBC-318
@Test
public void shouldMapIsNull() {
Criteria criteria = Criteria.where("name").isNull();
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" IS NULL");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapIsLt.
// DATAJDBC-318
@Test
public void shouldMapIsLt() {
Criteria criteria = Criteria.where("name").lessThan("a");
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 shouldMapAndCriteria.
// DATAJDBC-318
@Test
public void shouldMapAndCriteria() {
Criteria criteria = Criteria.where("name").is("foo").and("bar").is("baz");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" = ?[:name] AND person.bar = ?[:bar]");
}
use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapSomeNestedCriteria.
// DATAJDBC-318
@Test
public void shouldMapSomeNestedCriteria() {
Criteria criteria = Criteria.empty().and(Collections.emptyList()).and(Criteria.empty().and(Criteria.where("name").is("Hank")));
assertThat(criteria.isEmpty()).isFalse();
Condition condition = map(criteria);
assertThat(condition).hasToString("((person.\"NAME\" = ?[:name]))");
}
Aggregations