DATAJPA-1171 - CrudRepository.exists(…) does no longer contain a 1 = 1 clause in query.
Changed the query generating code to use streams and joiner which made it simpler and the use of 1 = 1 superfluous. Original pull request: #212.
This commit is contained in:
committed by
Oliver Gierke
parent
8b2140b421
commit
557ce91b4a
@@ -70,6 +70,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Sébastien Péralta
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
public abstract class QueryUtils {
|
||||
|
||||
@@ -183,14 +184,14 @@ public abstract class QueryUtils {
|
||||
Iterable<String> idAttributes) {
|
||||
|
||||
StringBuilder sb = new StringBuilder(String.format(COUNT_QUERY_STRING, countQueryPlaceHolder, entityName));
|
||||
sb.append(" WHERE ");
|
||||
String append = " WHERE ";
|
||||
|
||||
for (String idAttribute : idAttributes) {
|
||||
sb.append(append);
|
||||
sb.append(String.format(EQUALS_CONDITION_STRING, "x", idAttribute, idAttribute));
|
||||
sb.append(" AND ");
|
||||
append = " AND ";
|
||||
}
|
||||
|
||||
sb.append("1 = 1");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user