Hi--
To follow up, here is the current generic account bean that I am trying to
setup according to the DTO and facade patterns. CMR is with another address
bean that also has value objects associated, as well:
package homebrew.ejb.entity;
// javax.ejb imports
import javax.ejb.CreateException;
// homebrew ejb imports
import homebrew.ejb.interfaces.accountHolderBeanValue;
import homebrew.ejb.interfaces.accountHolderBeanData;
import homebrew.ejb.interfaces.accountHolderBeanPK;
// util imports
import java.util.Collection;
/**
*
* @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.unknown-pk
* class="java.lang.Integer"
* column-name="account_id"
* jdbc-type="INTEGER"
* sql-type="INTEGER"
* auto-increment="true"
*
* @jboss.entity-command
* name="account_id_pk"
*
class="org.jboss.ejb.plugins.cmp.jdbc.hsqldb.JDBCHsqldbCreateCommand"
*
* @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
*/
public abstract class accountHolderBean extends defaultEntityBean
{
/**
* @ejb.pk-field
* @ejb.persistent-field
* @ejb.interface-method
*
* @ejb.persistence
* column-name="account_id"
* auto-increment="true"
*
* @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);
/**
* @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="Addresses"
*
members="homebrew.ejb.interfaces.accountAddressBeanLocal"
* members-name="AddressValue"
* relation="external"
*/
public abstract Collection getAddresses();
/**
* @ejb:interface-method view="local"
*/
public abstract void setAddresses(Collection addresses);
/**
* @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 getAccountHolderValue();
/**
* @ejb.interface-method view="local"
*/
public abstract void setAccountHolderValue(accountHolderBeanValue
theAccountHolderValue);
/**
*
* @ejb.create-method
*/
public java.lang.Object ejbCreate(accountHolderBeanValue theValue)
{
return null;
}
public void ejbPostCreate(accountHolderBeanValue theValue)
{
}
/*
*
* @ejb.create-method
*/
/*public java.lang.Object ejbCreate(String theEmailAddress,
String theEmailTypeCd,
String theAccountPassword) throws CreateException
{
setAccountRoleId(new Integer(1));
setEmailAddress(theEmailAddress);
setEmailTypeCd(theEmailTypeCd);
setAccountPassword(theAccountPassword);
return null;
}
public void ejbPostCreate(String theEmailAddress,
String theEmailTypeCd,
String theAccountPassword) throws CreateException
{
}*/
}
Sorry - should have included this info in the original post... :(
Regards,
Matt Hanson
-----Original Message-----
From: Hanson, Matthew [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 10:05 AM
To: '[EMAIL PROTECTED]'
Subject: [Xdoclet-user] ejb.facade and valueobjects
Hi--
I am currently switching the design of my app from using xdoclet dataobjects
with homemade entity facades to valueobjects and the xdoclet-gen'd facades.
Specifically, I thought that the value objects from xdoclet would greatly
help in updating/adding/removing the n (many) side of cmr.
I am wondering if someone could provide some enlightenment on the usage of
the entity facade from xdoclet.
I saw in the online docs that valueobject elements are to replace the
deprecated dataobjects elements. Seeing this, I assumed I should someday
stop generating dataobjects altogether?
With the deprecation of dataobjects, I had also assumed that the facades
would probably generate methods to return value objects, but I see that
dataobjects are primarily the return references. Data objects have
references to value objects, so should I get the dataobject from the facade,
then get the value object from the data object in order to set or update
properties, including the 1-n cmr objects? I don't see an update/set
methods on the facade that take either data or value objects and,
presumably, update the persistant data store.
As you can see, I am hoping to maintain the cmr fields that I have and
switch to using value object and the xdoclet facade. However, I just do not
yet understand how I can provide updates to the entity and cmr entities
using the provided pattern. Can anyone provide some client code or a means
for gaining this understanding?
Thank you very much!
Matt Hanson
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user