| 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
|
 |
 |
|
|
subject: ejb/jboss-ql finder woes.
|
|
|