jboss-ql LIKE problem!
apsona Dec 20, 2002 5:58 AMI am having a problem getting jboss-ql to work with a LIKE parameter clause.
Using JBoss 3.0.4 with XDoclet 1.2beta1 and i mark up my jboss-ql tag as follows:
* @ejb.finder signature="Collection findByRoom(java.lang.Integer roomId)"
* unchecked="true"
* query=""
* @jboss.query signature="Collection findByRoom(java.lang.Integer roomId)"
* strategy="on-load"
* query="SELECT OBJECT(o) FROM Function AS f, IN (f.rooms) AS o WHERE (o.roomId LIKE CONCAT(?1,'%')) ORDER BY o.roomId"
Which produces this in the jbosscmp-jdbc.xml:
<query-method>
<method-name>findByRoom</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</query-method>
<jboss-ql><![CDATA[SELECT OBJECT(o) FROM Function AS f, IN (f.rooms) AS o WHERE (o.roomId LIKE CONCAT(?1,'%')) ORDER BY o.roomId]]></jboss-ql>
<read-ahead>
on-load
</read-ahead>
I have tried different variations of the query such as removing the CONCAT, having a query in
ejb.finder etc but to no avail. When the ql is parsed during deployment i get the following:
12:05:12,611 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=TeamLocalHome,service=EJB
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "LIKE" at line 1, column 72.
Was expecting one of:
")" ...
"+" ...
"-" ...
"*" ...
"/" ...
"NOT" ...
"IN" ...
"=" ...
">" ...
">=" ...
"<" ...
"<=" ...
"<>" ...
"BETWEEN" ...
)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.(JDBCJBossQLQuery.java:46)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createJBossQLQuery(JDBCCommandFactory.java:54)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:203)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:463)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:369)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
at org.jboss.ejb.Container.invoke(Container.java:756)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy5.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:398)
at java.lang.reflect.Method.invoke(Native Method)
.....
Is there something that i am missing or is there a known problem that i don't know about ?
Many thanks in advance,
Paul