What you have provided is an entity bean. There are
no problems when declaring @ejb.create-method directly
within an entity bean.
The problem occurs when declaring the
@ejb.create-method tag within a plain old Java
abstract base class that the entity beans extend to
take advantage of the plain Java abtract base class'
fields and methods.
Take a look at my original post and you will notice
that my base class is just a plain old Java abstract
class that does not implement javax.ejb.EntityBean.
This type of setup works well with
@ejb.interface-method and @ejb.persistence tags
declared within the plain old Java abstract base class
that is extended by entity beans and will put those
methods in the XDoclet generated *BeanCMP classes, the
remote and local interfaces, and the generated
deployment descriptor. The only quirk is that XDoclet
has problems generating the create methods within the
local/remote home interfaces when @ejb.create-method
is declared in the plain old Java abstract base class
that the entity beans extend, but XDoclet will
generate the correct deployment descriptor
(ejb-jar.xml) information under
<assembly-descriptor><container-transaction><method>
...blah, blah, blah, ...
</method></container-transaction></assembly-descriptor>
if you include the @ejb.transaction tag along with the
@ejb.create-method tag. I have included a sample of
the code again below.
Thanks.
*********Sample Base & Entity Classes*********
public abstract class MyDataBaseBean {
/**
* Creates a new instance of MyDataBaseBean
*/
public MyDataBaseBean() {
}
/**
* @ejb.create-method
* view-type="local"
* @ejb.transaction
* type="Required"
*/
public test.primkeys.MyDataBeanPK
ejbCreate(test.MyData myData,
test.localinterfaces.MyDataLocal myDataLocal) throws
javax.ejb.CreateException {
setMyData1(myData.getData1());
setMyData2(myData.getData2());
return null;
}
public void ejbPostCreate(test.MyData myData,
test.localinterfaces.MyDataLocal myDataLocal) throws
javax.ejb.CreateException {
setMyData(myDataLocal);
}
/**
* @ejb.interface-method
* view-type="local"
* @ejb.persistence
* column-name="high"
*/
public abstract java.math.BigDecimal getHigh();
public abstract void setHigh(java.math.BigDecimal
high);
.........
}
/**
* @ejb.bean
* name="MyDataABean"
* type="CMP"
* @ejb.pk
* class="test.primkeys.MyDataBeanPK"
*
* @jboss.audit-updated-time
* field-name="updated"
* column-name="updated"
* @jboss.persistence
* table-name="MyDataA"
*/
public abstract class MyDataABean extends
MyDataBaseBean implements javax.ejb.EntityBean {
private javax.ejb.EntityContext context;
.........
}
--- Marco Mistroni <[EMAIL PROTECTED]> wrote:
> Hello,
> ok could you do something for me?
> i write below the ejb that i m using, would you
> mind running xdoclet
> against it and tell me
> what's get generated, so i see if the problem is the
> xdoclet tags or the
> environment?
> here it is
> -----------------------------------------------
>
> package com.myapp.ejb;
>
> import javax.ejb.*;
>
> /**
> * @ejb.bean
> * name="ExpenseType"
> * type="CMP"
> * cmp-version="2.x"
> * jndi-name="budget/ExpenseTypeHome"
> * primkey-field="id"
> *
> * @ejb.finder
> * signature="java.util.Collection findAll()"
> *
> * @ejb.persistence table-name="types"
> *
> * @openejb
> *
> * @ejb.transaction type="Required"
> *
> * @jboss.unknown-pk class="java.lang.Integer"
> * auto-increment="true"
> *
> * @jboss.persistence datasource="worldcorp/MySqlDS"
> * createTable="false"
> * removeTable="false"
> *
> */
> public abstract class ExpenseTypeBean implements
> EntityBean
> {
>
> /** @ejb.create-method */
> public Integer ejbCreate(Integer type, String
> description) throws
> CreateException {
> this.setId(type);
> this.setDescription(description);
> return null;
> }
>
>
> public abstract void setId(Integer id);
>
> /**
> * @ejb.interface-method
> * @ejb.persistence
> */
> public abstract Integer getId();
>
>
> /**
> * @ejb.interface-method
> * @ejb.persistence
> */
> public abstract String getDescription();
>
> /**
> * @ejb.interface-method
> */
> public abstract void setDescription(String desc);
>
> }
>
> pls let me know what are the files that gets
> generated..
>
> you could mail to me privately (i doubt that list
> allows attachment) at
> [EMAIL PROTECTED]
>
> regars
>
> marco
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
xdoclet-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user