-
1. Re: loosing @jboss:finder-query ???
lorensrosen Jan 9, 2003 12:20 PM (in response to hanzz)I'm not sure what's wrong here. But if you just want to get simple queries like these working, you might try using the ejb-ql rather than the jboss-ql.
The other piece of advice I can give is that xdoclet isn't a perfect abstraction -- sometimes you have to look at the generated files to figure out the problem.
If you're still stuck attach the code to your bean and I'll take a closer look at it. -
2. Re: loosing @jboss:finder-query ???
guydaniel Feb 10, 2003 4:40 AM (in response to hanzz)hanzz,
In case you still need help on this, you have to use the xdoclet merge function to push some EJQL into ejb-jar.xml.
You have to create an xml finder snippet and name this ejb-finders-{0}.xml, and put it in your "xdoclet merge dir", where "{0}" is your bean name (eg. CustomerBean)
An example finder query xml snippet:
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>[CDATA[
SELECT OBJECT(d)
FROM customer d
WHERE d.name = ?1
]]</ejb-ql>
I don't think xdoclet looks at the comment embedded sql ... although they might fix this if it is a bug ...
Regards,
Guy Daniel -
3. Re: loosing @jboss:finder-query ???
guydaniel Feb 13, 2003 4:33 PM (in response to hanzz)I found a better way, without using merge files:
* @ejb.finder signature="java.util.Collection findByName( java.lang.String pName )"
* view-type="local"
* query="SELECT OBJECT(d) FROM database d WHERE d.name = ?1"
* result-type-mapping="Local" *
*
* @jboss.query signature="java.util.Collection findByName( java.lang.String pName )"
* query="SELECT OBJECT(d) FROM database d WHERE d.name = ?1" -
4. Re: loosing @jboss:finder-query ???
guydaniel Feb 13, 2003 5:33 PM (in response to hanzz)Well , I thought it was a better way after looking at ejb-jar.xml, but this does not work.
I found the only way to make queries work is to stick them in a merge file, or you get a funny jboss error.
This error seems to be related to the format of the query in ejb-jar.xml. Xdoclet will put the query all on one line in ejb, even if you space it out in the comment.
If I do this with a merge file :
<ejb-ql><![CDATA[
SELECT OBJECT(d)
FROM database d
WHERE d.name = ?1
]]></ejb-ql>
it works!
If I rely on the automatic xdoclet generated query, I get this in ejb-jar.xml:
<ejb-ql><![CDATA[SELECT OBJECT(d) FROM database d WHERE d.name = ?1]]></ejb-ql>
and JBoss gives me:
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException
: Encountered "SELECT" at line 2, column 13.
Was expecting one of:
"AND" ...
"OR" ...
)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46) -
5. Re: loosing @jboss:finder-query ???
lafr Feb 14, 2003 1:20 PM (in response to hanzz)What version of JBoss do you use ?
With JBoss-4.0 I have no problems with this. -
6. Re: loosing @jboss:finder-query ???
guydaniel Feb 14, 2003 8:11 PM (in response to hanzz)My JBoss version is 3.0.6