Update of /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/resources
In directory sc8-pr-cvs1:/tmp/cvs-serv17552
Modified Files:
valueobject.xdt
Log Message:
Two changes: 1) generated equals() now short-circuits on identity -- if the object is
being compared
to itself, it equals returns true. Regardless of whether the PK is set, the same
binary pointer
points to the same object. 2) the outcome of calling VO.addSth(sthVal) then later
calling
VO.updateSth(sthVal) should not result in a failed update because the sthVal has not
been created
yet. This probably works fine in situations where the PK is pre-generated because the
update
happens after the add and the PK is common in both sthVal, but if the PK is generated
in the
ejbCreate of the object, the PK is unknown to the sthVal, and the updateSth will fail.
To get
around this, the addSth hash is checked, and if the object exists there already, it's
assumed that
it does not need to be updated just after adding. This is more efficient as well.
Index: valueobject.xdt
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** valueobject.xdt 27 Nov 2002 16:26:19 -0000 1.13
--- valueobject.xdt 3 Dec 2002 03:16:26 -0000 1.14
***************
*** 212,216 ****
public void
update<XDtEjbValueObj:currentAggregateName/>(<XDtEjbValueObj:currentAggregateType/>
updated)
{
! if ( ! this.updated<XDtEjbValueObj:currentAggregateName/>s.contains(updated))
this.updated<XDtEjbValueObj:currentAggregateName/>s.add(updated);
}
--- 212,216 ----
public void
update<XDtEjbValueObj:currentAggregateName/>(<XDtEjbValueObj:currentAggregateType/>
updated)
{
! if ( !this.updated<XDtEjbValueObj:currentAggregateName/>s.contains(updated)
&& !this.added<XDtEjbValueObj:currentAggregateName/>s.contains(updated))
this.updated<XDtEjbValueObj:currentAggregateName/>s.add(updated);
}
***************
*** 278,281 ****
--- 278,283 ----
public boolean equals(Object other)
{
+ if (this == other)
+ return true;
if ( ! hasIdentity() ) return false;
if (other instanceof
<XDtClass:classOf><XDtEjbValueObj:valueObjectClass/></XDtClass:classOf>)
-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel