[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3888) QueryParser to restrictive, does not allow hash sign (#) in string literal
David Rosell (JIRA)
jira-events at lists.jboss.org
Fri Jan 9 10:53:04 EST 2009
QueryParser to restrictive, does not allow hash sign (#) in string literal
--------------------------------------------------------------------------
Key: JBSEAM-3888
URL: https://jira.jboss.org/jira/browse/JBSEAM-3888
Project: Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.1.1.GA
Environment: jboss-seam-2.0.2.SP1, hibernate-entitymanager-3.4.0.GA, spring-2.5.6
Reporter: David Rosell
The QueryParser are to restrictive when validating a query expression.
It is not possible to use a hash sign (#) in a String literal query expression.
An IllegalArgumentException are thrown for this query:
String ejbql = "SELECT s FROM Service s WHERE s.name = 'DB#CORE' ";
Query q = em.createQuery(ejbql);
Rather than using:
StringTokenizer tokens = new StringTokenizer(ejbql, "#}", true);
it would be better to be more precise in selecting what should be processed, use regexp and splitting the ejbql expression for #{...} instead.
Exception stacktrace:
java.lang.IllegalArgumentException: missing { after # in query fragment
at org.jboss.seam.persistence.QueryParser.<init>(QueryParser.java:52)
at org.jboss.seam.persistence.QueryParser.<init>(QueryParser.java:33)
at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:66)
at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.ioc.spring.SeamManagedEntityManagerFactory$SeamManagedPersistenceContextHandler.invoke(SeamManagedEntityManagerFactory.java:142)
at $Proxy71.createQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:198)
at $Proxy58.createQuery(Unknown Source)
at com.ford.volvocars.r2r.db.jpa.GenericDaoJpa.executeJpaQuery(GenericDaoJpa.java:40)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list