I am writing beans that I would like to use from within the EJB container and from a remote client.  I need both Local and Remote interfaces for my beans.  I am trying to use xdoclet to generate both Local and Remote interface classes for my beans and am having a problem with getter/setter methods for properties that are other beans.

 

For example, I have a base class called CampaignBean containing the xdoclet tags.  Xdoclet will generate classes for CampaignBean, Campaign, CampaignHome, CampaignLocal and CampaignLocalHome.  I can access methods in CampaignLocal and CampaignLocalHome from servlets running within the same JVM as the bean container (I'm using xdoclet xdoclet-1.2b.3 and Orion 2.0.2 on Windows XP).  I can also access methods in Campaign and CampaignHome from a plain old runnable Java class that I execute from the command line.  This all works as expected.

 

However, I have another bean called Account that has a CMP field that is a Campaign bean.  I would like to have my getter method (getCampaign) to return a CampaignLocal in AccountLocal and to return a Campaign object in Account.  And I would like to have my setter method (setCampaign) accept a CampaignLocal in AccountLocal and to accept a Campaign object in Account.  In other words, I want to end up with the following methods:

 

In AccountLocal:

public CampaignLocal getCampaign() ;

public void setCampaign(CampaignLocal campaign) ;

 

In Account:

public Campaign getCampaign() ;

public void setCampaign(Campaign campaign) ;

 

The xdoclet tags I am using in AccountBean are:

/**

* @ejb.persistence

*    column-campaign="campaign"

* @ejb.interface-method

*    view-type="both"

**/

   public abstract CampaignLocal getCampaign();

/**

* @ejb.interface-method

*    view-type="both"

**/

   public abstract void setCampaign(CampaignLocal campaign);

 

What I end up with in both AccountLocal and Account is:

public CampaignLocal getCampaign() ;

public void setCampaign(CampaignLocal campaign) ;

 

 

What I'm getting at is I would like my CMP fields that happen to be other beans to show up in both the local and remote interfaces just like all the other fields (like Strings, ints, etc.).  Am I asking the impossible?  Is this a general EJB 2.0 issue that has nothing to do with xdoclet?

 

Thanks,

 

Mark

Reply via email to