-
1. Re: DynamicQL, Xdoclet, and compile errors
redbeard15 Nov 22, 2004 6:27 PM (in response to redbeard15)All right, I have the code compiling..... I added the following code to ProductBean.java:
public abstract java.util.Collection findGeneral (java.lang.String id, Object[] args) throws FinderException;
But now I have deployment problems. When I deploy this package, JBoss complains with:Method : public abstract Collection findProducts(Hashtable) throws FinderException Section: 10.5.6 Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.
Sooooo, a 'findxxx()' method is assumed to be a finder method. Okay. If I change 'findProducts()' to 'searchProducts()', as in:/** * @ejb.home-method * view-type="local" */ public java.util.Collection searchProducts (Hashtable clauses) throws FinderException { . . . . . return findGeneral (jbossQL.toString(), args); }
JBoss (at deployment) complains with:Method : public abstract Collection searchProducts(Hashtable) throws FinderException Section: 12.2.11 Warning: Each local home method must match a method defined in the entity bean class.
Hmmm. But ProductLocalHome includes a 'public Collection searchProducts()...'
Ideas? -
2. Re: DynamicQL, Xdoclet, and compile errors
redbeard15 Nov 22, 2004 10:16 PM (in response to redbeard15)I got JBoss DynamicQL working with Xdoclet!!
Here are changes (from my original posts) I had to do....
1) Change the declaration of 'searchProducts()' in my ProductBean to 'ejbHomeSearchProducts()'.
Note case sensitivity. This causes a 'searchProducts()' method to be put in the ProductLocalHome interface
(er, the @ejb.home-interface tag does).
That got rid of the 'Warning: Each local home method must match a method...' error msg at deployment.
2) Change the declaration and use of 'findGeneral()' to 'ejbSelectGeneral()'. Xdoclet appears to be looking for specific
function name prefixes and handles them accordingly. 'ejbSelect...()' is one of them.
3) Removed the @ejb.finder signature="java.util.Collection ejbSelectGeneral...' tag in ProductBean.java.
But I had to leave the @jboss.query signature="java.util.Collection ejbSelectGeneral...' tag in there.
For some reason, Xdoclet was putting two<query> <query-method> <method-name>ejbSelectGeneral</method-name>
nodes in the ejb-jar.xml file (but only one in the jbosscmp-jdbc.xml file. Just declaring the
'public abstract Collection ejbSelectGeneral(...)' method in the bean file was enough for Xdoclet to add a single <query...>
node to ejb-jar.xml.
Done!
Well, not quite. I reeeeeally want to use the SQL LIKE operator with parameters. Guess I need to upgrade to 3.2.6 or 4.0.....