Author: manaRH
Date: 2010-01-22 14:28:28 -0500 (Fri, 22 Jan 2010)
New Revision: 11985
Modified:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/framework/Query.java
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/QueryTest.java
Log:
JBPAPP-3461
Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/framework/Query.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/framework/Query.java 2010-01-22
18:51:48 UTC (rev 11984)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/framework/Query.java 2010-01-22
19:28:28 UTC (rev 11985)
@@ -28,7 +28,7 @@
public abstract class Query<T, E>
extends PersistenceController<T> //TODO: extend MutableController!
{
- private static final Pattern SUBJECT_PATTERN = Pattern.compile("^select
(\\w+((\\s+|\\.)\\w+)*)\\s+from", Pattern.CASE_INSENSITIVE);
+ private static final Pattern SUBJECT_PATTERN =
Pattern.compile("^select\\s+(\\w+(?:\\s*\\.\\s*\\w+)*?)(?:\\s*,\\s*(\\w+(?:\\s*\\.\\s*\\w+)*?))*?\\s+from",
Pattern.CASE_INSENSITIVE);
private static final Pattern FROM_PATTERN =
Pattern.compile("(^|\\s)(from)\\s", Pattern.CASE_INSENSITIVE);
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);
Modified:
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/QueryTest.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/QueryTest.java 2010-01-22
18:51:48 UTC (rev 11984)
+++
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/QueryTest.java 2010-01-22
19:28:28 UTC (rev 11985)
@@ -42,6 +42,10 @@
// TODO this should eventually become count(v.person)
assertEquals(query.getCountEjbql(), "select count(*) from Vehicle v left join
v.person");
+ query.setEjbql("select v.person, v.color from Vehicle v");
+ query.parseEjbql();
+ assertEquals(query.getCountEjbql(), "select count(*) from Vehicle v");
+
query = new CompliantUnitQuery();
query.setEjbql("select p from Person p");
query.parseEjbql();
Show replies by date