EJB-QL does not support parameters in the like clause, but JBossQL does. To use JBossQL copy your query element to the jbosscmp-jdbc.xml file, and change ejb-ql to jboss-ql. For more information on the proper formatting of the jbosscmp-jdbc.xml file see the dtd.
Thanks for that. Does anyone know how you would achieve a similar result in EJB-QL?
Extract the jboss.jar and search for it.
You can't; that's why I wrote JBossQL.
You can achieve a similar result by using the LOCATE function (which produces a more expensive query of course).
This doesn't work in EJB-QL, but shouldn't it ?
WHERE o.name LIKE CONCAT(?1, '%')
Read the grammar in the spec. The patters must be a string literal. I could easily add this to JBossQL, but I won't unless it is widely supported.
Will or does JBossQL support a max function?
Will. I think Antonio is about to start on this. Aggregate function are part of the forth coming EJB 2.1 specification.
Cool, so since it will be part of the EJB-QL 2.1 spec I guess JBossQL won't have to support it.
Until they release the spec this will only be in JBossQL.
I've try to develop a "like" statement in jbosscmo-jdbc.xml but at deploy time, it complains :
"ERROR [XmlFileLoader] XmlFileLoader: File file:/users/vol1/gardais/app-serv/jboss-3.0.0beta/tmp/deploy/89.facade-jms-like.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 84. Error message: Element "query" does not allow "jboss-ql" here."
After studying the DTD, i see no explanation for that behaviour as the query tag allows "(jboss-ql|dynamic-ql|declared-ql)?"
Does anybody know why do i get this message ?
INFO [Server] JBoss (MX MicroKernel) [3.0.0beta Date:200202210220]
jbosscmp-jdbc.xml uses the following doctype :
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
thanks for any help,
Order matters. Make sure you have the tags in the same order. If that doesn't work post the query section.
I was wondering if order matters or not and you give me the answer.
I've check for the order thing already.
It doesn't solve my problem.
Here is my Query section :
selectionne les personnes dont le nom commence par ...
<jboss-ql>select distinct object(p) from personneBean p where p.nom like ?1</jboss-ql>
I've try it with and without the same query declared in the ejb-jar.xml but the problem remains.
I also get an error message from JBoss when deploying a query in jbosscmp-jdbc.xml that wasn't declared in ejb-jar.xml such as "no matching request in ejb-jar.xml" or something like this.
But when I include the same request in the ejb-jar file, it complains that "like" isn't supported.
thanks for your help,