Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / August 2003

Tip: Looking for answers? Try searching our database.

xDoclet generates ejb-jar.xml wrong

Thread view: 
Lars Rohleder - 05 Aug 2003 19:30 GMT
Hi folks,

I'm trying to use xDoclet in a small sample application. After two days
of trying everthing works fine except of one thing: xDoclet generates an
ejb-jar.xml which defines all interfaces for every bean (Home, Remote,
LocalHome and Local).
What I want is local interfaces for my entity beans and remote
interfaces for all session beans. I used
@ejb.interfaces
    generate="local"
and only the local interfaces get generated. But sadly ejb-jar.xml
defines the remote interfaces too.

Any suggestions?

Lars

***************
Here's an entity bean:

package buchshop.ejb;

import java.util.Collection;
import javax.ejb.*;
import javax.naming.*;

import buchshop.util.Sequence;

/**
 * @ejb.bean
 *      name="EJB_Kunde"
 *      local-jndi-name="buchshop/ejb/EJB_KundeLocal"
 *      primkey-field="m_nKundeNr"
 *
 * @ejb.interface
 *      generate="local"
 *
 * @ejb.value-object
 *      match="*"
 *      name="Kunde"
 */
abstract public class EJB_KundeBean implements EntityBean {
    private EntityContext ctx;

    public void setEntityContext(EntityContext context) throws
EJBException {
        ctx = context;
    }

    public void unsetEntityContext() throws EJBException {
        ctx = null;
    }

    public void ejbActivate() throws EJBException {
    }

    public void ejbPassivate() throws EJBException {
    }

    public void ejbRemove() throws EJBException {
    }

    public void ejbStore() throws EJBException {
    }

    public void ejbLoad() throws EJBException {
    }

    /**
     * @ejb.create-method
     */
    public Integer ejbCreate() throws CreateException, EJBException {
        setM_nKundeNr(Sequence.next());
        return null;
    }

    public void ejbPostCreate() throws CreateException, EJBException {
    }

    /**
     * @ejb.pk-field
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract Integer getM_nKundeNr() throws EJBException;
    public abstract void setM_nKundeNr(Integer param) throws EJBException;

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strName();
    public abstract void setM_strName(String param);

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strVorname();
    public abstract void setM_strVorname(String param);

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strAnrede();
    public abstract void setM_strAnrede(String param);

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strAnschrift();
    public abstract void setM_strAnschrift(String param);

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strPlz();
    public abstract void setM_strPlz(String param);

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strOrt();
    public abstract void setM_strOrt(String param);

    /**
     * @ejb.value-object
     * @ejb.persistence
     */
    public abstract String getM_strLand();
    public abstract void setM_strLand(String param);

    /**
     * @ejb.interface-method
     */
    public abstract buchshop.vo.KundeValue getKundeValue();
    /**
     * @ejb.interface-method
     */
    public abstract void setKundeValue(buchshop.vo.KundeValue kundeValue);
}

************************************
And this is my ant task "ejbdoclet":

    <target depends="init" name="ejbdoclet">
        <taskdef classname="xdoclet.modules.ejb.EjbDocletTask"
classpathref="classpath" name="ejbdoclet"/>
        <ejbdoclet destdir="${src}" ejbspec="2.0"
excludedtags="@author, @version">
            <fileset dir="${src}">
                <include name="buchshop/ejb/*Bean.java"/>
            </fileset>
            <remoteinterface/>
            <localinterface/>
            <homeinterface/>
            <localhomeinterface/>
            <valueobject>
                <packageSubstitution packages="ejb" substituteWith="vo"/>
            </valueobject>
            <deploymentdescriptor destdir="${meta-inf}"/>
        </ejbdoclet>
    </target>

*********************
The ejb-jar.xml says:

[...]
      <entity >
         <description><![CDATA[]]></description>

         <ejb-name>EJB_Kunde</ejb-name>

         <home>buchshop.ejb.EJB_KundeHome</home>
         <remote>buchshop.ejb.EJB_Kunde</remote>
         <local-home>buchshop.ejb.EJB_KundeLocalHome</local-home>
         <local>buchshop.ejb.EJB_KundeLocal</local>

         <ejb-class>buchshop.ejb.EJB_KundeBean</ejb-class>
         <persistence-type>Container</persistence-type>
         <prim-key-class>java.lang.Integer</prim-key-class>
         <reentrant>False</reentrant>
         <cmp-version>2.x</cmp-version>
         <abstract-schema-name>EJB_Kunde</abstract-schema-name>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_nKundeNr</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strName</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strVorname</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strAnrede</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strAnschrift</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strPlz</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strOrt</field-name>
         </cmp-field>
         <cmp-field >
            <description><![CDATA[]]></description>
            <field-name>m_strLand</field-name>
         </cmp-field>
         <primkey-field>m_nKundeNr</primkey-field>

     <!-- Write a file named ejb-finders-EJB_KundeBean.xml if you want to
define extra finders. -->
      </entity>
[...]
Marek Lange - 05 Aug 2003 20:52 GMT
> What I want is local interfaces for my entity beans and remote
> interfaces for all session beans. I used
> @ejb.interfaces
>     generate="local"
> and only the local interfaces get generated. But sadly ejb-jar.xml
> defines the remote interfaces too.

>  * @ejb.bean
>  *      name="EJB_Kunde"
[quoted text clipped - 8 lines]
>  *      name="Kunde"
>  */

Could you try

@ejb.bean
 *    ...
 *    view-type="local"
 *    ...

-marek
Lars Rohleder - 05 Aug 2003 22:37 GMT
> Could you try
>
[quoted text clipped - 4 lines]
>
> -marek

Yes, that's it! Thanks a lot, Marek!

Lars


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.