Search in sources :

Example 21 with Condition

use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.

the class QueryMapperUnitTests method shouldMapOrCriteria.

// DATAJDBC-318
@Test
public void shouldMapOrCriteria() {
    Criteria criteria = Criteria.where("name").is("foo").or("bar").is("baz");
    Condition condition = map(criteria);
    assertThat(condition).hasToString("person.\"NAME\" = ?[:name] OR person.bar = ?[:bar]");
}
Also used : Condition(org.springframework.data.relational.core.sql.Condition) Criteria(org.springframework.data.relational.core.query.Criteria) Test(org.junit.jupiter.api.Test)

Example 22 with Condition

use of org.springframework.data.relational.core.sql.Condition in project spring-data-jdbc by spring-projects.

the class QueryMapperUnitTests method shouldMapIsLike.

// DATAJDBC-318
@Test
public void shouldMapIsLike() {
    Criteria criteria = Criteria.where("name").like("a");
    Condition condition = map(criteria);
    assertThat(condition).hasToString("person.\"NAME\" LIKE ?[:name]");
}
Also used : Condition(org.springframework.data.relational.core.sql.Condition) Criteria(org.springframework.data.relational.core.query.Criteria) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)22 Criteria (org.springframework.data.relational.core.query.Criteria)22 Condition (org.springframework.data.relational.core.sql.Condition)22 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)1