[seam-commits] Seam SVN: r15257 - in branches/enterprise/WFK-2_1/jboss-seam/src: test/java/org/jboss/seam/test/unit and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Oct 11 10:22:46 EDT 2012
Author: manaRH
Date: 2012-10-11 10:22:46 -0400 (Thu, 11 Oct 2012)
New Revision: 15257
Modified:
branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/framework/Query.java
branches/enterprise/WFK-2_1/jboss-seam/src/test/java/org/jboss/seam/test/unit/QueryTest.java
Log:
JBSEAM-4529
Modified: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/framework/Query.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/framework/Query.java 2012-10-11 14:22:32 UTC (rev 15256)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/framework/Query.java 2012-10-11 14:22:46 UTC (rev 15257)
@@ -33,6 +33,8 @@
private static final Pattern WHERE_PATTERN = Pattern.compile("\\s(where)\\s", Pattern.CASE_INSENSITIVE);
private static final Pattern ORDER_PATTERN = Pattern.compile("\\s(order)(\\s)+by\\s", Pattern.CASE_INSENSITIVE);
private static final Pattern GROUP_PATTERN = Pattern.compile("\\s(group)(\\s)+by\\s", Pattern.CASE_INSENSITIVE);
+ private static final Pattern JOIN_FETCH_PATTERN = Pattern.compile("join fetch", Pattern.CASE_INSENSITIVE);
+ private static final String JOIN_OPERATOR="join";
private static final Pattern ORDER_COLUMN_PATTERN = Pattern.compile("^\\w+(\\.\\w+)*$");
@@ -319,9 +321,9 @@
throw new IllegalStateException("invalid select clause for query");
}
}
-
+ String fromToWherePart=JOIN_FETCH_PATTERN.matcher(ejbql.substring(fromLoc, whereLoc)).replaceAll(JOIN_OPERATOR);
return new StringBuilder(ejbql.length() + 15).append("select count(").append(subject).append(") ").
- append(ejbql.substring(fromLoc, whereLoc).replace("join fetch", "join")).
+ append(fromToWherePart).
append(ejbql.substring(whereLoc, groupLoc)).toString().trim();
}
Modified: branches/enterprise/WFK-2_1/jboss-seam/src/test/java/org/jboss/seam/test/unit/QueryTest.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/test/java/org/jboss/seam/test/unit/QueryTest.java 2012-10-11 14:22:32 UTC (rev 15256)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/test/java/org/jboss/seam/test/unit/QueryTest.java 2012-10-11 14:22:46 UTC (rev 15257)
@@ -40,7 +40,7 @@
assertEquals(query.getCountEjbql(), "select count(distinct p) from Person p");
query.setUseWildcardAsCountQuerySubject(true);
- query.setEjbql("select v from Vehicle v join fetch v.person");
+ query.setEjbql("select v from Vehicle v JOIN FETCH v.person");
query.setOrderColumn("make");
query.parseEjbql();
// TODO this should eventually become count(v)
More information about the seam-commits
mailing list