This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JBoss and the fly likes ejb/jboss-ql finder woes. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "ejb/jboss-ql finder woes." Watch "ejb/jboss-ql finder woes." New topic
Author

ejb/jboss-ql finder woes.

jeroen dijkmeijer
Ranch Hand

Joined: Sep 26, 2003
Posts: 131
Hi,
I'm currently trying to implement an findall method (simplest of the simplest) but I cant get it to work allright. It deploys fine, but as soon as I call home.findAll() it fails with the following stacktrace dump:
javax.ejb.FinderException: Find failed: java.sql.SQLException: Unexpected token: FROM in statement [SELECT FROM SUBJECT t0_s]
at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:194)
I have jboss-ql generated by xdoclet:
<query>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<jboss-ql><![CDATA[select OBJECT(s) from Subject As s]]></jboss-ql>
</query>
It seems that in the generated sql being fired to the server the specification of the select statement is void. So I expect that I'm doing something wrong with column names or so.
Could somebody help me??
If desired I can provide the complete ejb-jar, jbosscmp-jdbc files.
Many Thnx in advance.
Jeroen
Edward Kenworthy
Ranch Hand

Joined: Oct 05, 2003
Posts: 66
Can't help you dissect your code, xdoclet always seems extremely arcane and using it is more an art than a science. What I can do is give you some of my code, which works.
This is the important bit, the class level tags. The important tag is
@ejb.finder signature="java.util.Collection findAll()"
Which should be all you need to do to get a findAll method.
/**
* @author edward
* @version 0.1
*
* @ejb.bean type="CMP"
* view-type="local"
* name="ProjectBean"
* local-jndi-name="${app.name}/ProjectLocal"
* primkey-field="ID"
* @ejb.value-object
* @ejb.util generate="physical" cacheHomes="true"
* @ejb.finder signature="java.util.Collection findAll()"
* @ejb.persistence table-name="PROJECT"
*
* @jboss:create-table create="${table_create}"
* @jboss:remove-table remove="${table_delete}"
*
* @ejb.finder
* method-intf="LocalHome"
* query="SELECT OBJECT(r) FROM ProjectBean r WHERE r.owner = ?1"
* result-type-mapping="Local"
* signature="java.util.Collection findByOwner(java.lang.String owner)"
*
*/
I assume you're using all right sub-tasks to ejbdoclet in your in build.xml, these are the relevant ones (I think):
<jboss version="3.2" destdir="${meta.inf.dir}"/>
<entitycmp/>
Hope this helps!
Edward
jeroen dijkmeijer
Ranch Hand

Joined: Sep 26, 2003
Posts: 131
Thnx a lot for the answer.
Yes u'r totally right on xdoclet, its very powerful, but you have to know the magic spells which I haven't figured out completely yet.
Anyway this problem relates to fact that I didn't supply a foreign key. That was also the reason why there was nothing between "select" and "from". Maybe jboss could provide a bit more descriptive error msg here.
BTW I learned this from a crossposting on the jboss.org site.
Thnx again for your posting.
Jeroen.
Vasile Bucur
Greenhorn

Joined: Feb 25, 2004
Posts: 1

thanks guys this is just the info i've been looking for
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejb/jboss-ql finder woes.
 
Similar Threads
ejbql-jboss problem
Error compiling EJB-QL statement ''; FROM not found
help regarding JBOSS QL for EJB 2.0...
jboss.finder-query
Error in EJB-QL......