• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejb/jboss-ql finder woes.

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

thanks guys this is just the info i've been looking for
 
reply
    Bookmark Topic Watch Topic
  • New Topic