Thanks for the helpful information Andrew. My printed documentation must cover an old version since it doesn't list the @jboss.declared-sql tag. Thanks for pointing that out. The latest xdoclet documentation is fairly detailed and gives me some hope of working since the ejb-name says it is required if used for an ejbSelect method.
[aside] The more I use EJB-QL I have to wonder why they bothered. It seems to be missing so many basic features... I'm too far committed in my project now but even the declarative transaction support of CMPs seems overrated since specifying the isolation level of a transaction is not declarable. I have the strange feeling that I've added a JVM, a bunch of duplicated code and XML, some abstracted layers and confused things more than if I had just gone with a simpler, direct SQL approach. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Stevens Sent: Wednesday, January 14, 2004 5:01 PM To: [EMAIL PROTECTED] Subject: Re: [Xdoclet-user] @ejb.select problems with JBoss On Tue, 2004-01-13 at 20:21, Patrick Bakker wrote: > I?ve been trying to get the following select method code to work in an > EJB I call Product: > > > > /** > > * @ejb.select > * signature="java.util.Collection ejbSelectNameMatch(String nameMatch)" > * query="SELECT OBJECT(p) FROM Product p WHERE p.name LIKE ?1" ... > However, when I deploy it to a JBoss 3.2.3 server it fails to compile > the EJB-QL, stopping on the LIKE ?1 portion of the EJB-QL. According to the EJB 2.0 spec, section 11.2, "Input parameters can only be used in comparison_expressions or collection_member_expressions, as defined in Section 11.4". If you look at the definition of simple_cond_expression in that BNF definition, you'll see that LIKE expressions aren't either of these (nor are IN or BETWEEN expressions), so it's not valid to use a ?x parameter in them. The pattern-value of a LIKE expression must be "a string literal" (section 11.2.7.9). Hence the error messages you are seeing: > Error compiling EJB-QL statement 'SELECT OBJECT(p) FROM Product p > WHERE p.name LIKE ?1'; - nested throwable: > (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at > line 1, column 51. > > Was expecting: > > <STRING_LITERAL> ... > > )] For what it's worth, in the 2.1 spec it's changed to say "The pattern_value is a string literal or a string-valued input parameter". So I guess you just need a newer version of JBoss which supports EJB 2.1 (assuming there is one; I don't use it myself so don't know if there is). > The odd thing is that I have finder methods using the same syntax > which compile and work fine. The only difference between the finder > and select method that I?ve noticed is that I can supply an > SQL-specific query to override the otherwise generated query for the > finder methods. I have not yet found a way to do the same for the > select methods. Is this possible? Any QL extensions or other ways to override the query is going to be specific to each app server, so I presume you're talking about the @jboss.declared-sql tag? Although its description says "Configures a custom query (defined by @ejb.finder)", so far as I can tell you should be able use it for the select queries as well. The signature parameter just specifies a <query-method> from the ejb-jar.xml, and those are generated for select methods as well as finders. Andrew. ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
