9 Replies Latest reply on May 16, 2002 10:37 AM by brian smith

    jbosscmp-jdbc.xml with xDoclet?

    Alex Rublin Newbie

      how to generate jbosscmp-jdbc.xml with xDoclet?
      thanks

        • 1. Re: jbosscmp-jdbc.xml with xDoclet?
          brian smith Newbie

          Did you ever get xdoclet to generate the jbosscmp-jbdb correctly. When my file gets generated it leaves out the query descriptor tags.

          • 2. Re: jbosscmp-jdbc.xml with xDoclet?
            Olger Warnier Newbie

            See below the classpath settings and the call for running xdoclet. In my ant/lib directory there are some additional jar files:
            log4j-core.jar
            xdoclet.jar
            ant.jar
            jakarta-ant-1.4.1-optional.jar
            junit.jar
            log4j.jar

            I'm running ant 1.4.1 and xdoclet 1.1.2
            unit testing of your ejbs (Local Interfaces) is possible using junit (www.junit.org) and junitejb (I don't know where that came from)





















            <!-- fileset dir="${ejbsrc}">

            </fileset -->











            • 3. Re: jbosscmp-jdbc.xml with xDoclet?
              brian smith Newbie

              I looked at my build file and it's very simular. Are you using JBoss 3.0 RC2 with this version of XDoclet. Do you know what tag generates the query descriptors inside the jbosscmp-jdbc.xml.

              • 4.
                Olger Warnier Newbie

                 

                • 5. Re: jbosscmp-jdbc.xml with xDoclet?
                  Olger Warnier Newbie

                  I believe the:
                  <jboss version=3.0 ... etc tag
                  Attached in the previous message is an (partly) example of the xdoclet code I use. (something went wrong the forum)
                  I removed some of the fields to keep it readable.
                  So it won't work like that (because of the finder queries inside use fields that are no longer part of this example)

                  Good luck

                  • 6. Re: jbosscmp-jdbc.xml with xDoclet?
                    brian smith Newbie

                    Thanks for your reply. Unfortunately I still am not able to generate the query descriptor tag inside the jbosscmp-jdbc.xml file that gets created. Is there a particular tag that I need to include.

                    • 7. Re: jbosscmp-jdbc.xml with xDoclet?
                      Olger Warnier Newbie

                      Hmm, your right.

                      this piece of xdoclet code:
                      * @ejb:finder
                      * signature="java.util.Collection findAllAuthenIDs(java.lang.String serviceID)"
                      * unchecked="true"
                      * query="SELECT OBJECT(a) FROM AttributeDefinition AS a WHERE a.serviceID = ?1 AND a.authenticationID = 1"
                      * result-type-mapping="Remote"

                      generates this:


                      <query-method>
                      <method-name>findAllAuthenIDs</method-name>
                      <method-params>
                      <method-param>java.lang.String</method-param>
                      </method-params>
                      </query-method>
                      <result-type-mapping>Remote</result-type-mapping>
                      <ejb-ql><![CDATA[SELECT OBJECT(a) FROM AttributeDefinition AS a WHERE a.serviceID = ?1 AND a.authenticationID = 1]]></ejb-ql>


                      in the ejb-jar.xml

                      This is enough to get it working with the CMP engine. There is no need for a tag in the jbosscmp-jdbc.xml

                      When your query needs more features than the standard ejbql supports, there is a need for a jbossql query.
                      That indeed needs to be in the jbosscmp-jdbc.xml

                      We just ran into some queries that needs this. So I will try to get that working.
                      Please show some code if you get it working at an earlier stage.

                      Thx

                      • 8. Re: jbosscmp-jdbc.xml with xDoclet?
                        Olger Warnier Newbie

                        Found the way to get it in the jbosscmp-jdbc.xml file

                        your tag:
                        @jboss:finder-query name="findByName" query="name = {$1}"


                        change it to:

                        @jboss:declared-sql signature="Collection findByName(java.lang.String name)" where="name = {$1}"



                        the template file jbosscmp-jdbc_xml.j in xdoclet shows the available tags and their parameters.

                        next to where, you can use the parameters:
                        order
                        other

                        Didn't test the outcome, please reply if this will work.

                        • 9. Re: jbosscmp-jdbc.xml with xDoclet?
                          brian smith Newbie

                          Olger,

                          It worked! Thanks for your help. I knew it had to be something simple that was causing it not to generate. Once again thanks.