4 Replies Latest reply on Oct 11, 2002 8:38 AM by Petr MRAZ

    finders again

    Petr MRAZ Newbie

      yes, the last answer from Clark helps, BUT a new trouble arised. The deployment is now okay, but when i try to call that finder (localy from session bean) i get this exception:

      javax.ejb.FinderException: Unknown query: public abstract java.util.Collection test.EBCounterLocalHome.findByName(java.lang.String) throws javax.ejb.FinderException

      The code fot that finder is:
      * signature="java.util.Collection findByName(java.lang.String text)"
      * @jboss:finder-query name="findByName"
      * query="SELECT OBJECT(o) FROM ebcounter o WHERE o.data = ?1"
      Any idea why? And btw, is chance to get container generated SQL query to check? (No query is sent to DB server when this exception arise)

        • 1. Re: finders again
          sfan Newbie


          I saw you post several times and I post the same question before, but no body answer my question. Now, I tell you my solution for this problem.

          I successfully run template war. And test it by jsp page. In the back end, I code query and execute the query. And then I try finder method, it get me "unknown query" error.
          You see, in the template project, the author did use finder himself. I guess, at least for JBoss3.0, the server don't know the syntax of the query which is generated by xdoclet. If you still want to use xdoclet and template project as template, you can try ejb-ql instead of just query.
          I give up the template project and make gangster sample project work fine. You need a new build.xml and jsp page for gangster project display on 8080 port

          Good luck

          • 2. Re: finders again
            Clarke Wood Newbie

            Ok I believe I have finally figured out the correct solution to this issue. Disregard my previous post about using the @jboss.finder-query tag. Use of that tag is restricted to CMP1 and only writes query information into jaws.xml.

            I had to upgrade to xdoclet 1.2.0 beta 1 and update my build.xml and a few tags to work with the new xdoclet.

            I used xdoclet's new "schema" parameter in the @ejb.bean tag to set the bean's abstract schema name properly (for example, I had a UserBean so I added the tag @ejb.bean schema="User"). That fix resolved the deploy error I was getting that was something like 'found "User" but was expecting "IN"...'.

            I then changed my finder query tags back so they now look something like:
            @ejb.finder signature="User findByName(java.lang.String name)" view-type="remote" method-intf="Home" result-type-mapping="Remote" query="SELECT DISTINCT OBJECT(u) FROM User u WHERE u.name = ?1"

            I am now able to successfully deploy and use my finder queries. I hope that helps you resolve your problems.

            • 3. Re: finders again
              Clarke Wood Newbie

              oops, I just checked and realized I made a mistake when I referred to the @ejb.bean schema parameter as new to xdoclet 1.2.0. It is present in xdoclet 1.1.2, but for some reason I didn't notice it until the new version.

              If you add schema="ebcounter" to your @ejb.bean tag, you might be able to stick with xdoclet 1.1.2 and still resolve your issues by moving your ejb-ql query from the @jboss.finder-query tag back to the @ejb.finder tag (like you had it before).

              I haven't gone back and tested my code with the old xdoclet so I can't say with certainty that this will work, but it might be worth a shot if you are dead-set on sticking with xdoclet 1.1.2.

              • 4. Re: finders again
                Petr MRAZ Newbie

                Super, now it works well! Thanks Clarke.