5 Replies Latest reply on Oct 31, 2002 9:04 AM by Konstantin

    custom finder findByXYZ not working using JAWS/XDoclet/JBoss

    nat Newbie

      Hello,


      I am fairly new to JBoss so please show me where I may be making a mistake.

      I have a bean called Reservation and I am trying to make a custom finder called findByDateSpan ( Date dateFrom, Date dateTo)

      I am using XDoclet for the generation of jaws.xml and ejb-jar.xml .

      Here is what I put in the javadoc section of ReservationBean.java:

      * @ejb:finder signature="java.util.Collection findByDateSpan ( java.sql.Date pDateFrom, java.sql.Date pDateTo )"
      *
      * @jboss:finder-query name="findByDateSpan"
      * query="dateFrom > {1} AND dateTo < {2}"
      *

      Here is what XDoclet creates for me in jaws.xml :

      <ejb-name>myproject/Reservation</ejb-name>
      ....

      findByDateSpan
      <![CDATA[dateFrom > {1} AND dateTo < {2}]]>


      ...


      Now, when I try to deploy this, I get the following error:

      2002-10-23 13:57:56,774 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.myproject/Reservation] Could not create the finder findByDateSpan, because no matching CMP field was found

      Any ideas as to what I can be doing wrong ?

      thanks in advance!

      s3ma4

        • 1. Re: custom finder findByXYZ not working using JAWS/XDoclet/J
          nat Newbie

          I am resending this message because I got no replies.
          I am having problems defining my own custom finder methods and using XDoclet. If anyone has any examples of how they did it successfully please let me know. ASAP please! :)
          thanks

          Here's my original post.




          > Hello,
          >
          >
          > I am fairly new to JBoss so please show me where I
          > may be making a mistake.
          >
          > I have a bean called Reservation and I am trying to
          > make a custom finder called findByDateSpan ( Date
          > dateFrom, Date dateTo)
          >
          > I am using XDoclet for the generation of jaws.xml and
          > ejb-jar.xml .
          >
          > Here is what I put in the javadoc section of
          > ReservationBean.java:
          >
          > * @ejb:finder signature="java.util.Collection
          > findByDateSpan ( java.sql.Date pDateFrom,
          > java.sql.Date pDateTo )"
          > *
          > * @jboss:finder-query name="findByDateSpan"
          > * query="dateFrom > {1} AND
          > dateTo < {2}"
          > *
          >
          > Here is what XDoclet creates for me in jaws.xml :
          >
          > <ejb-name>myproject/Reservation</ejb-name>
          > ....
          >
          > findByDateSpan
          > [CDATA[dateFrom > {1} AND dateTo
          &gt; AND dateTo < {2}]]
          >
          >
          > ...
          >
          >
          > Now, when I try to deploy this, I get the following
          > error:
          >
          > 2002-10-23 13:57:56,774 DEBUG
          > [org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.mypro
          > ect/Reservation] Could not create the finder
          > findByDateSpan, because no matching CMP field was
          > found
          >
          > Any ideas as to what I can be doing wrong ?
          >
          > thanks in advance!
          >
          > s3ma4

          • 2. Re: custom finder findByXYZ not working using JAWS/XDoclet/J
            ytzel Newbie

            hi,

            look at your doclet query spec.
            does this <![CDATA[dateFrom > {1} AND dateTo < {2}]]> looks like an ejb-ql query method, where is the select?!?
            the signature in the doclet tag should be something like this:

            @ejb:finder = ....
            query=" select ... from ... <your where clause>

            • 3. Re: custom finder findByXYZ not working using JAWS/XDoclet/J
              Tin Blaskovic Newbie

              He's still using JAWS and xdoclet 1.1 which are obsolete. I suggest downloading xdoclet 1.2beta and using JBoss-QL/EJB-QL which are much more documented. You can find the EJB-QL syntax in Sun's J2EE tutorial. JBoss-QL is the same, just has more features. If you want an example, then here's a query in JBoss-QL as should be defined in xdoclet:

              @ejb.bean name="something"
              schema="someschema"
              @ejb.finder signature="java.util.Collection findByField ( String pField )"
              query=""
              result-type-mapping="Local"
              @jboss.query signature="java.util.Collection findByField ( String pField )"
              query="select Object(s) from someschema s where s.somefield like ?1"

              That should get you started.

              • 4. Re: custom finder findByXYZ not working using JAWS/XDoclet/J
                nat Newbie

                Thanks, I will do that.
                In the future how can I know about updates like this ? Is there one "source" for all this up-to-the-minute information ?

                And, as a general design consideration, should I steer away from XDoclet and hand-generate all my classes ?

                thanks

                s3ma4

                • 5. Re: custom finder findByXYZ not working using JAWS/XDoclet/J
                  Konstantin Newbie

                  If you like to hear about xdoclet updates,
                  you shall subscribhe to one of xdoclet mailing
                  lists.

                  We send announcements out.

                  Of course you can stop using xdoclet,
                  but then just imagine amount of work
                  needed to implement simple change in data type or
                  to add yet another attribute to you EJB.

                  And I would not like to miss my value/data objects,
                  utility classes, automatically generated
                  beaninfo and a load of other cool stuff...