Hello Paul,

there are to problems with your query.
First, left operand (o.roomId) must be of type String.
Second, the parameter to CONCAT must also be of type String.

Though, it occurs, in plain SQL, MySql, for example, allows integers in both cases.

alex

Friday, December 20, 2002, 3:04:15 PM, you wrote:

RP> I am having a problem getting jboss-ql to work with a LIKE parameter clause.
 
RP> Using JBoss 3.0.4 with XDoclet 1.2beta1 and i mark up my jboss-ql tag as
RP> follows:

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

RP> Any e-mail message from the European Central Bank (ECB) is sent in good faith but 
shall neither be binding nor construed as constituting a commitment by the ECB except 
where provided for in a
RP> written agreement.
RP> This e-mail is intended only for the use of the recipient(s) named above. Any 
unauthorised disclosure, use or dissemination, either in whole or in part, is 
prohibited.
RP> If you have received this e-mail in error, please notify the sender immediately 
via e-mail and delete this e-mail from your system.


-- 
Best regards,
 Alex Loubyansky




-------------------------------------------------------
This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
Time is running out!  Thinkgeek.com has the coolest gifts for
your favorite geek.   Let your fingers do the typing.   Visit Now.
T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to