use of org.springframework.data.relational.repository.query.RelationalParametersParameterAccessor in project spring-data-jdbc by spring-projects.
the class PartTreeJdbcQueryUnitTests method createsQueryToFindAllEntitiesByStringAttributeNotLike.
// DATAJDBC-318
@Test
public void createsQueryToFindAllEntitiesByStringAttributeNotLike() throws Exception {
JdbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameNotLike", String.class);
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
RelationalParametersParameterAccessor accessor = getAccessor(queryMethod, new Object[] { "%John%" });
ParametrizedQuery query = jdbcQuery.createQuery(accessor, returnedType);
assertThat(query.getQuery()).isEqualTo(BASE_SELECT + " WHERE " + TABLE + ".\"FIRST_NAME\" NOT LIKE :first_name");
}
use of org.springframework.data.relational.repository.query.RelationalParametersParameterAccessor in project spring-data-jdbc by spring-projects.
the class PartTreeJdbcQueryUnitTests method createsQueryToFindAllEntitiesByIntegerAttributeLessThanEqual.
// DATAJDBC-318
@Test
public void createsQueryToFindAllEntitiesByIntegerAttributeLessThanEqual() throws Exception {
JdbcQueryMethod queryMethod = getQueryMethod("findAllByAgeLessThanEqual", Integer.class);
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
RelationalParametersParameterAccessor accessor = getAccessor(queryMethod, new Object[] { 30 });
ParametrizedQuery query = jdbcQuery.createQuery(accessor, returnedType);
assertThat(query.getQuery()).isEqualTo(BASE_SELECT + " WHERE " + TABLE + ".\"AGE\" <= :age");
}
use of org.springframework.data.relational.repository.query.RelationalParametersParameterAccessor in project spring-data-jdbc by spring-projects.
the class PartTreeJdbcQueryUnitTests method createsQueryToFindAllEntitiesByIntegerAttributeGreaterThan.
// DATAJDBC-318
@Test
public void createsQueryToFindAllEntitiesByIntegerAttributeGreaterThan() throws Exception {
JdbcQueryMethod queryMethod = getQueryMethod("findAllByAgeGreaterThan", Integer.class);
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
RelationalParametersParameterAccessor accessor = getAccessor(queryMethod, new Object[] { 30 });
ParametrizedQuery query = jdbcQuery.createQuery(accessor, returnedType);
assertThat(query.getQuery()).isEqualTo(BASE_SELECT + " WHERE " + TABLE + ".\"AGE\" > :age");
}
use of org.springframework.data.relational.repository.query.RelationalParametersParameterAccessor in project spring-data-jdbc by spring-projects.
the class PartTreeJdbcQueryUnitTests method createsQueryToFindAllEntitiesByIntegerAttributeIsNull.
// DATAJDBC-318
@Test
public void createsQueryToFindAllEntitiesByIntegerAttributeIsNull() throws Exception {
JdbcQueryMethod queryMethod = getQueryMethod("findAllByAgeIsNull");
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
RelationalParametersParameterAccessor accessor = getAccessor(queryMethod, new Object[0]);
ParametrizedQuery query = jdbcQuery.createQuery(accessor, returnedType);
assertThat(query.getQuery()).isEqualTo(BASE_SELECT + " WHERE " + TABLE + ".\"AGE\" IS NULL");
}
use of org.springframework.data.relational.repository.query.RelationalParametersParameterAccessor in project spring-data-jdbc by spring-projects.
the class PartTreeJdbcQueryUnitTests method createsQueryWithLimitToFindEntitiesByStringAttribute.
// DATAJDBC-318
@Test
public void createsQueryWithLimitToFindEntitiesByStringAttribute() throws Exception {
JdbcQueryMethod queryMethod = getQueryMethod("findTop3ByFirstName", String.class);
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
RelationalParametersParameterAccessor accessor = getAccessor(queryMethod, new Object[] { "John" });
ParametrizedQuery query = jdbcQuery.createQuery(accessor, returnedType);
String expectedSql = BASE_SELECT + " WHERE " + TABLE + ".\"FIRST_NAME\" = :first_name LIMIT 3";
assertThat(query.getQuery()).isEqualTo(expectedSql);
}
Aggregations