I avoid this problem by not using inheritance for the home interfaces. 
In other words, each bean includes the tag
@ejb:home extends="javax.ejb.EJBHome"
local-extends="javax.ejb.EJBLocalHome"

On Wed, 2002-05-29 at 14:32, Pete Marsden wrote:
> The problem I seem to be having is that when I compile my class, I get an
> "incompatible return types" error on the findByPrimaryKey(String) and
> create().  Of course both of these methods are returning a remote interface.
> The problem is that the base classes' version of these methods in the home
> interface return the base class remote interface and the leaf class version
> of these methods returns the leaf classes' remote interface.
> 
> I am not sure if this is a xdoclet bug.  I just looked through the bug list.
> It may likely be that I am not including a tag or something.
> 
> *** Is there a way to force xdoclet not to generate a default create and
> findByPrimaryKey?
> 
> Below is my leaf class:
> 
> /**
>  * @ejb:bean
>  *      name="ExpenseEJB"
>  *      type="CMP"
>  *      cmp-version="2.x"
>  *      jndi-name="Expense"
>  *      local-jndi-name="LocalExpense"
>  *      display-name="EJB CMP - ExpenseEJB"
>  *      view-type="both"
>  *      reentrant="false"
>  * @ejb:pk class="java.lang.String" generate="false"
>  *
>  * @ejb:data-object equals="false"
>  * @ejb:transaction-type Required
>  * @jboss:table-name cashflows
>  * @jboss:create-table false
>  * @jboss:remove-table false
>  * @jboss:tuned-updates true
>  *
>  * @ejb:interface
>  *      extends="CashFlow"
>  * @ejb:home
>  *      extends="CashFlowHome"
>  */
> 
> public abstract class ExpenseEJB extends CashFlowEJB implements EntityBean {
> ...
> }
> 
>   -----Original Message-----
>   From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Ara Abrahamian
>   Sent: Wednesday, May 29, 2002 1:52 PM
>   To: 'Pete Marsden'; [EMAIL PROTECTED]
>   Subject: RE: [Xdoclet-user] Inheritance and XDoclet
> 
> 
>   Yeah, I've seen a report for this bug, probably submitted to bugs database
> too. If not filed then open a new bug entry for it.
> 
> 
> 
>   Btw you can easily fix this problem by defining an AbstractTest session
> bean and deriving the two other beans from it. It's always a good idea to
> derive from an abstract base class than a concrete one.
> 
> 
> 
>   Ara.
> 
> 
> 
>   -----Original Message-----
>   From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of Pete Marsden
>   Sent: Wednesday, May 29, 2002 7:25 PM
>   To: [EMAIL PROTECTED]
>   Subject: [Xdoclet-user] Inheritance and XDoclet
> 
> 
> 
>   Hello,
> 
> 
> 
>   This is my first post to this list and I am frustrated.  Everything is
> working fine for me in my refactoring from ejbgen/websphere to xdoclet/jboss
> except when I try to use inheritance.
> 
> 
> 
>   The problem occurs during the compile and has to do with the fact that
> xdoclet is generating (in the case of the stateless session bean) a default
> create method in each class which return different types.
> 
> 
> 
>   I tried to put a create method that had the same signature as the base
> class hoping to cause xdoclet not to generate the create method but that
> didn't work.
> 
> 
> 
>   I see that the examples use inheritance and that is what kills me.  What
> am I doing wrong?  What do I need to do to implement entity inheritance?
> 
> 
> 
>   Code below:
> 
> 
> 
>   Thanks for your help
> 
>   Pete--
> 
> 
> 
> 
> 
>   BASE CLASS
> 
>   ---------------------
> 
>   /**
>    * @ejb:bean
>    *      name="TestBaseBO"
>    *      type="Stateless"
>    *      cmp-version="2.x"
>    *      jndi-name="TestBaseBO"
>    *      display-name="EJB Stateless - TestBaseBO"
>    *      view-type="both"
>    *      reentrant="false"
>    */
> 
>   public class TestBaseBO implements SessionBean  {
> 
>   }
> 
> 
> 
> 
> 
>   TEST CLASS
> 
>   ---------------------
> 
>   /**
>    * @ejb:bean
>    *      name="TestBO"
>    *      type="Stateless"
>    *      cmp-version="2.x"
>    *      jndi-name="TestBO"
>    *      display-name="EJB Stateless - TestBO"
>    *      view-type="both"
>    *      reentrant="false"
>    */
> 
>   public class TestBO extends TestBaseBO implements SessionBean  {
> 
>   }
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to