Hi!
I have some troubles with the generated ValueObjects.
I have a ContactBean wich contains the following definition to refer some
Addresses.
/**
* get related Addresses
*
[...]
* @ejb.value-object
*
compose="com.vescon.aum.common.valueobject.masterdata.AddressValue"
* compose-name="Address"
* match="*"
*
members="com.vescon.aum.server.iface.masterdata.AddressLocal"
* members-name="Address"
* relation="external"
* type="Collection"
*
**/
public abstract Collection getAddresses();
The source in the generated ValueObject for the remove method looks like
that:
public void removeAddress (AddressValue removed)
{
this.Addresss.remove(removed);
this.removedAddresss.add(removed);
if (this.addedAddresss.contains(removed))
this.addedAddresss.remove(removed);
if (this.updatedAddresss.contains(removed))
this.updatedAddresss.remove(removed);
}
The problem is that if I add a new Address with 'addAddress' and then I will
remove the Address with 'removeAddress' the address is not removed form the
'Addresss'-ArrayList. I found out that the remove method uses the equals
method of the elements to find it in the ArrayList, but the equals mehtod is
overide in the AddressValue-Object (see below). The new equals method just return
true if both elements has an identity! Therefore the new added address (the
id is generated on the server) will never be removed from the
'Addresss'-ArrayList.
public boolean equals(Object other)
{
if ( ! hasIdentity() ) return false;
if (other instanceof AddressValue)
{
AddressValue that = (AddressValue) other;
if ( ! that.hasIdentity() ) return false;
boolean lEquals = true;
lEquals = lEquals && this.id == that.id;
lEquals = lEquals && isIdentical(that);
return lEquals;
}
else
{
return false;
}
}
is this a bug??
what can I do to solve this problem?
thanks in advance,
rudi
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr f�r 1 ct/ Min. surfen!
-------------------------------------------------------
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