Im trying to build a value object from my CMP Entity beans with a composite, and think I've found a bug.

I need the composite object to have a specified name instread of its entity bean name.
In this example the container object is called "Contact" and the composit is "Address"
I need the contact object to have a field DefaultAddress.
A similar example is an Order and DeliveryAddress and InvoiceAddress.




Anyway onto the code.
This is the relation from my Contact entity bean.


/** Default address is 1-1 with an item in the address table.
*
* @ejb.interface-method
*
* @ejb.relation
* name="contact-default_address"
* role-name="contact-has-default_address"
* target-ejb="Address"
* target-role-name="address-belongs_to-contact"
* target-cascade-delete="yes" *
* @ejb.value-object
* name="HELLO THIS DOSE NOTHING 111"
* compose="com.starjar.crm.domain.address.model.AddressValue"
* compose-name="DefaultAddress"
* members-name="AddressValue"
* members="HELLO THIS DOSE NOTHING 333"
* relation="internal"
*
* @jboss.relation
* fk-column="default_address_fk"
* related-pk-field="ID"
* fk-contraint="${db.foreign.key}
*/
public abstract AddressLocal getDefaultAddress( );


public abstract void setDefaultAddress( AddressLocal address );



This generates produces buggy code in ContactCMP
       // Checks for null composition
       if (valueHolder.getDefaultAddress() != null)
       {
        java.lang.Integer pk = valueHolder.getDefaultAddress().getID();

com.starjar.crm.domain.address.interfaces.AddressLocalHome home = com.starjar.crm.domain.address.util.AddressUtil.getLocalHome();

com.starjar.crm.domain.address.interfaces.AddressLocal relation = home.findByPrimaryKey(pk);
relation.setDefaultAddress(valueHolder.getDefaultAddress());
^^^^^^^^^^^^
}


The problem line is
relation.setDefaultAddress(valueHolder.getDefaultAddress());
and should be
relation.setAddressValue(valueHolder.getDefaultAddress());


I did some digging and I think
xdoclet\modules\ejb\src\xdoclet\modules\ejb\entity\resources\entity-value.xdt line 225 is incorrect.
relation.set<XDtEjbValueObj:currentAggregateName/>(valueHolder.get<XDtEjbValueObj:currentAggregateName/>());


Im thinking it should be something like
relation.set<XDtMethod:methodTagValue tagName="ejb:value-object" paramName="members-name"/>(valueHolder.get<XDtEjbValueObj:currentAggregateName/>());


Which would make the @ejb.value-object members-name="AddressValue" actually useful.

Any feed back on this would be appreciated as Im very new to EJB/CMP/xdoclet.
(as im having some "fun" getting xdoclet to compile from cvs atm)


Also feel free to rip apart + correct my xdoclet ejb/relationship tags.


Peter Henderson
















-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to