I have been able to deploy the following CMR2.0 bean (and "many-related"
beans) to jboss 3.2.1 with hypersonic db using xdoclet 1.2-beta3. However,
similar to an unanswered earlier post, the combination of xdoclet tags that
I had to use was derived almost from pure luck. The various tags for both
jboss and ejb have overlapping attributes for column, auto-increment, etc.,
for primary keys. I was hoping someone might be able to point me to the
proper combinations, whether from experience or from dtd (?), or if I have
extraneous attributes in the following bean:
/**
*
* @ejb.bean name="accountHolderBean"
* display-name="General account information"
* local-jndi-name="homebrew/ejb/entity/accountHolderBean"
* view-type="local"
* type="CMP"
* schema="account"
*
* @ejb.home generate="local"
*
* @ejb.interface generate="local"
*
* @ejb.pk extends="java.lang.Object"
*
* @ejb.transaction type="Required"
*
* @ejb.value-object match="*"
*
* @jboss.persistence
* datasource="java:/DefaultDS"
* datasource-mapping="Hypersonic SQL"
*
* @jboss.table-name table-name="account"
*
* @jboss.entity-command
* name="hsqldb-fetch-key"
*
* @ejb.finder
* view-type="local"
* signature="java.util.Collection findByEmailAddress(
java.lang.String theEmailAddress )"
* query="SELECT OBJECT(a) FROM account AS a WHERE
a.emailAddress = ?1"
*
* @ejb.facade
*
* @ejb.util
* generate="physical"
*/
public abstract class accountHolderBean extends defaultEntityBean
{
/**
* @ejb.pk-field
* @ejb.persistent-field
* @ejb.interface-method
*
* @ejb.persistence
*
* @jboss.column-name name="account_id"
*
* @jboss.auto-increment
*/
public abstract Integer getAccountId();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="account_id"
* @jboss.persistence auto-increment="true"
*/
public abstract void setAccountId(Integer theAccountId);
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="account_role_id"
*/
public abstract void setAccountRoleId(Integer theAccountRoleId);
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="account_role_id"
*/
public abstract Integer getAccountRoleId();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="email_address"
*/
public abstract String getEmailAddress();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="email_address"
*/
public abstract void setEmailAddress(String theEmailAddress);
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="email_type_cd"
*/
public abstract String getEmailTypeCd();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="email_type_cd"
*/
public abstract void setEmailTypeCd(String theEmailTypeCd);
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="account_password"
*/
public abstract String getAccountPassword();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="account_password"
*/
public abstract void setAccountPassword(String theAccountPassword);
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="first_name"
*/
public abstract String getFirstName();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="first_name"
*/
public abstract void setFirstName(String theFirstName);
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="ssn"
*/
public abstract Integer getSSN();
/**
* @ejb.interface-method view="local"
* @ejb.persistent-field
*
* @jboss.column-name name="ssn"
*/
public abstract void setSSN(Integer theSSN);
// begin 1:n address relationship
// 1. aggregate-name is the name of the container
// in the value object holding the n address value
objects
// 2. aggregate is the type of value object being
// held by the container
// 3. members-name is the method signature for the
// add/remove methods for addresses in the CMP class
// 4. members is the local interface to the address bean
// used by the add/remove methods in the CMP class
/**
* @ejb:interface-method view="local"
*
* @ejb.relation
* name="Account-Address"
* role-name="Account-Has-Addresses"
* target-ejb="accountAddressBean"
* target-role-name="Address-Belongs-To-Account"
*
* @ejb.value-object
* type="Collection"
*
aggregate="homebrew.ejb.interfaces.accountAddressBeanValue"
* aggregate-name="Address"
*
members="homebrew.ejb.interfaces.accountAddressBeanLocal"
* members-name="AcctAddress"
* relation="external"
*
* @jboss.target-relation fk-column="account_id"
* related-pk-field="accountId"
*/
public abstract Collection getAddresses();
/**
* @ejb:interface-method view="local"
*/
public abstract void setAddresses(Collection addresses);
// end 1:n address relationship
// begin 1:n recipe relationship
// 1. aggregate-name is the name of the container
// in the value object holding the n recipe value
objects
// 2. aggregate is the type of value object being
// held by the container
// 3. members-name is the method signature for the
// add/remove methods for recipes in the CMP class
// 4. members is the local interface to the recipe bean
// used by the add/remove methods in the CMP class
/**
* @ejb:interface-method view="local"
*
* @ejb.relation
* name="Account-Recipe"
* role-name="Account-Has-Recipes"
* target-ejb="AccountRecipeBean"
* target-role-name="Recipe-Belongs-To-Account"
*
* @ejb.value-object
* type="Collection"
*
aggregate="homebrew.ejb.interfaces.AccountRecipeBeanValue"
* aggregate-name="Recipe"
*
members="homebrew.ejb.interfaces.AccountRecipeBeanLocal"
* members-name="AcctRecipe"
* relation="external"
*
* @jboss.target-relation fk-column="account_id"
* related-pk-field="accountId"
*/
public abstract Collection getRecipes();
/**
* @ejb:interface-method view="local"
*/
public abstract void setRecipes(Collection recipes);
// end 1:n recipe relationship
/**
* @ejb.interface-method view="local"
*/
public abstract accountHolderBeanData getData();
/**
* @ejb.interface-method view="local"
*/
public abstract void setData(accountHolderBeanData theData);
/**
* @ejb.interface-method view="local"
*/
public abstract accountHolderBeanValue getaccountHolderBeanValue();
/**
* @ejb.interface-method view="local"
*/
public abstract void
setaccountHolderBeanValue(accountHolderBeanValue theAccountHolderValue);
/**
*
* @ejb.create-method
*/
public java.lang.Object ejbCreate(accountHolderBeanValue theValue)
throws CreateException
{
System.out.println("in ejbCreate for value object...");
setAccountRoleId(new Integer(1));
setEmailAddress(theValue.getEmailAddress());
setEmailTypeCd(theValue.getEmailTypeCd());
setAccountPassword(theValue.getAccountPassword());
return null;
}
public void ejbPostCreate(accountHolderBeanValue theValue) throws
CreateException
{
}
/**
*
* @ejb.create-method
*/
public java.lang.Object ejbCreate(String theEmailAddress,
String theEmailTypeCd,
String theAccountPassword) throws CreateException
{
System.out.println("in ejbCreate for email address...");
setAccountRoleId(new Integer(1));
setEmailAddress(theEmailAddress);
setEmailTypeCd(theEmailTypeCd);
setAccountPassword(theAccountPassword);
return null;
}
public void ejbPostCreate(String theEmailAddress,
String theEmailTypeCd,
String theAccountPassword) throws CreateException
{
}
}
For the related beans (address, brew recipe), I basically duplicated the tag
setup for primary key.
Thanks for all of the help!
Matt Hanson
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user