4 Replies Latest reply on Nov 11, 2004 11:27 AM by sunofra

    Cant get xdoclet to include create or getter method in inter

    sunofra

      I hate to ask this here but I'm getting desperate...

      No matter what I do I cant get Xdoclet to include my create method for my CMP test bean. Nor will it include any of the getter or setter methods. I must be doing something utterly stupid.

      Please feel free to point out my stupidity...
      Thanks


      package com.test;

      import javax.ejb.EntityBean;
      import javax.ejb.EntityContext;

      /**
      * @ejb.bean
      * display-name="ContactBean"
      * description="This bean represents a contact"
      * jndi-name="ejb/contact"
      * name="Contact"
      * type="CMP"
      * view-type="both"
      * primkey-field="ideaxid"
      * cmp-version="2.x"
      *
      * @ejb.persistence
      * table-name="contacts"
      *
      */
      public abstract class ContactBean implements EntityBean
      {

      public void setEntityContext(EntityContext ec)
      {
      }

      public void unsetEntityContext()
      {
      }

      public void ejbLoad()
      {
      }

      public void ejbStore()
      {
      }

      public void ejbActivate()
      {
      }

      public void ejbPassivate()
      {
      }

      public void ejbRemove()
      {
      }

      /*
      * @ejb.create-method
      */
      public Long ejbCreate(Long id) throws javax.ejb.CreateException
      {
      setIdeaxid(id);
      return null;
      }

      public void ejbPostCreate(Long id) {};

      public abstract Long getId();
      public abstract void setId(Long id);

      /*
      * @ejb.interface-method
      */
      public abstract String getName();

      /*
      * @ejb.interface-method
      */
      public abstract void setName(String name);

      /*
      * @ejb.interface-method
      */
      public abstract String getNotes();

      /*
      * @ejb.interface-method
      */
      public abstract void setNotes(String notes);

      }

        • 1. Re: Cant get xdoclet to include create or getter method in i
          darranl

          Can you also post an extract from your build.xml showing where XDcolet is invoked.

          • 2. Re: Cant get xdoclet to include create or getter method in i
            sunofra

            My pleasure. Here is the target which builds the "generated source" ... i.e., the remote, remotehome, local, and localhome interfaces.

            <target name="gensource">
            <delete dir="${gensrc}" />
            <mkdir dir="${gensrc}" />
            <tstamp>
            <format property="TODAY" pattern="yyyy-MM-dd" />
            </tstamp>

            <ejbdoclet
            destdir="${gensrc}"
            addedtags="@xdoclet-generated at ${TODAY}"
            ejbspec="2.0" >

            <fileset dir="${src}">
            <include name="**/*Bean.java"/>
            </fileset>

            <remoteinterface/>
            <homeinterface />
            <localinterface/>
            <localhomeinterface/>
            </ejbdoclet>
            </target>


            Whats killing me is that the interface classes are generated, but they are "empty". They dont contain the create method, nor the getter/setter methods. Furthermore, I have a Stateless Session bean right along side this class for which xdoclet generates everything correctly. Again, I must be doing something really dumb. Its very likely as I am new to j2ee programming.

            Thank You so much for taking a look at this.

            • 3. Re: Cant get xdoclet to include create or getter method in i
              sunofra

              Hmmmmm. Im not sure my tags came out looking like that but hopefully you can still see that clearly. :-(

              • 4. Re: Cant get xdoclet to include create or getter method in i
                sunofra

                A HA!
                I figured it out ... and as I suspected, I'm an idiot.
                If you notice the comments like this ...
                /*
                * @ejb.interface-method
                */

                where they should be like this ...

                /**
                * @ejb.interface-method
                */


                The difference is one little asterisk was missing!
                :-)