*
@ejb.bean name="Produit"* view-type="both"
* type="CMP"
* jndi-name="client/Produit"
* local-jndi-name="client/local/Produit"
*
* @ejb.value-object
* name="Produit"
* match="*"
...
and for the method:
/*** @ejb.value-object
* compose="com.sage.client.persist.props.CodeBarreValue"
* compose-name="CodeBarreValue"
* members="com.sage.client.persist.interfaces.CodeBarreLocal"
* members-name="CodeBarre"
* relation="external"
*
* @ejb.relation name="produit-codeBarre"
* role-name="one-produit-has-one-codeBarre"
* target-ejb="CodeBarre"
* target-role-name="one-codeBarre-belongs-to-one-produit"
* target-cascade-delete="yes"
*
* @jboss.relation
* fk-column="CODE_BARRE_ID"
* related-pk-field="id"*
* @ejb.interface-method view-type="local"
*/
public abstract CodeBarreLocal getCodeBarre();
/**
* @ejb.interface-method view-type="local"
*/
public abstract void setCodeBarre(CodeBarreLocal cb);
ProduitValue voProd1 = new
ProduitValue();voProd1.setId(GUID4.toString());
voProd1.setNom(NOM_PROD1);
voProd1.setVersion(VERSION1);
CodeBarreValue voCB1 = new CodeBarreValue();
voCB1.setId(GUID7.toString());
voCB1.setOrigin(ORIGIN_CB1);
ProduitRemote prod1 = produitHome.create(voProd1);
voProd1.setCodeBarreValue(voCB1);
prod1.setProduitValue(voProd1);
public
void setProduitValue( com.sage.client.persist.props.ProduitValue valueHolder ){
try
{
setNom( valueHolder.getNom() );
setVersion( valueHolder.getVersion() );
// Anonymous block to allow variable declations without conflicts
{
// Checks for null aggregate
if (valueHolder.getCodeBarreValue() != null)
{
com.sage.client.persist.interfaces.CodeBarrePK pk = new com.sage.client.persist.interfaces.CodeBarrePK(valueHolder.getCodeBarreValue().getId());
com.sage.client.persist.interfaces.CodeBarreLocalHome home = com.sage.client.persist.util.CodeBarreUtil.getLocalHome();
com.sage.client.persist.interfaces.CodeBarreLocal relation = home.findByPrimaryKey(pk);
relation.setCodeBarreValue(valueHolder.getCodeBarreValue());
}
}
}
catch (Exception e)
{
throw new javax.ejb.EJBException(e);
}
}
public void
setProduitValue( com.sage.client.persist.props.ProduitValue valueHolder
)
{
try
{
setNom( valueHolder.getNom() );
setVersion( valueHolder.getVersion() );
// Anonymous block to allow
variable declations without conflicts
{
//
Checks for null aggregate
if (valueHolder.getCodeBarreValue() != null)
{
com.sage.client.persist.interfaces.CodeBarreLocalHome home =
com.sage.client.persist.util.CodeBarreUtil.getLocalHome();
com.sage.client.persist.interfaces.CodeBarreLocal relation = home.create(valueHolder.getCodeBarreValue());
setCodeBarre(relation);
}
}
}
catch (Exception
e)
{
if(e instance of javax.ejb.CreateException)
{
throw (javax.ejb.CreateException)
e;
} else {
throw new
javax.ejb.EJBException(e);
}
}
