diff --git a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java index 87ddafc401046..1f4dbad0e363f 100644 --- a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java +++ b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java @@ -54,8 +54,6 @@ public void close() { private Map> filters; - private final String lineSeparator = System.getProperty("line.separator"); - public CommonPanacheQueryImpl(EntityManager em, String query, String orderBy, Object paramsArrayOrMap) { this.em = em; this.query = query; @@ -84,7 +82,7 @@ public CommonPanacheQueryImpl project(Class type) { throw new PanacheQueryException("Unable to perform a projection on a named query"); } - String lowerCasedTrimmedQuery = query.trim().replace(lineSeparator, " ").toLowerCase(); + String lowerCasedTrimmedQuery = query.trim().replace('\n', ' ').replace('\r', ' ').toLowerCase(); if (lowerCasedTrimmedQuery.startsWith("select new ")) { throw new PanacheQueryException("Unable to perform a projection on a 'select new' query: " + query); } @@ -95,7 +93,7 @@ public CommonPanacheQueryImpl project(Class type) { // New query: SELECT new org.acme.ProjectionClass(e.field1, e.field2) from EntityClass e if (lowerCasedTrimmedQuery.startsWith("select ")) { int endSelect = lowerCasedTrimmedQuery.indexOf(" from "); - String trimmedQuery = query.trim().replace(lineSeparator, " "); + String trimmedQuery = query.trim().replace('\n', ' ').replace('\r', ' '); // 7 is the length of "select " String selectClause = trimmedQuery.substring(7, endSelect).trim(); String from = trimmedQuery.substring(endSelect);