Hi, I want to implement a search for all names that begin with 'Sm'. Monson-Haefel claims this is impossible using EJB QL on a CMP field. What does this mean?
It seems to be easy to build queries with a fixed pattern like
SELECT OBJECT(c) FROM Customer c WHERE c.lastName LIKE '%-%'
But how to do it if the pattern should be '%<user transmitted pattern>%'
where <user transmitted pattern> is something that I catch from the GUI of my client application?
Thanks in advance,
Carsten
You have to use a JBoss specific extension called JBoss-QL in this case.
In my AddressBean I declare a ejb.finder with a constant expression after like and use a jboss.query with a placeholder instead.
XDoclet generates the query in ejb-jar.xml and in jbosscmp-jdbc.xml.
* @ejb.finder signature="java.util.Collection findByMatchcode( java.lang.String matchcode )"
* view-type="local"
* query="SELECT OBJECT(o) FROM Address AS o WHERE o.matchcode LIKE 'SIEMENS%'"
* result-type-mapping="Local"
* @jboss.query signature="java.util.Collection findByMatchcode( java.lang.String matchcode )"
* query="SELECT OBJECT(o) FROM Address AS o WHERE o.matchcode LIKE ?1 ORDER BY o.id"
Regards Frank
------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
