On Fri, 2004-01-16 at 21:12, Alexey Loubyansky wrote:
>  > Lastly could I ask if u know of a non jboss specific way to know
> when  a CMP Bean is modified?? 
>  
> The spec does not define it, so, the answer is no.

Actually you can, but it is a pain and inefficient because
you do it on every field access.

public abstract MyEntityBean extends EntityBean
{
   public abstract int getField1Internal();
   public abstract void setField1Internal(int value);
   public int getField1External()
   {
      return getField1Internal();
   }
   public void setField1External(int value)
   {
      if (value != getField1Internal())
         doModified(); // Here is your hook
      setField1Internal(value);
   }
   public abstract Date getLastModified();
   public abstract void setLastModified(Date date);
   public void doModified()
   {
      setLastModified(System.currentTimeMillis());
   }
}

You expose get/setField1External on the remote/local interface
and use field1Internal in the cmp mapping.
Writing your own xdoclet template might help with the boilerplate.

This is an alternate mechanism that is jboss specific:
http://sourceforge.net/tracker/index.php?func=detail&aid=685731&group_id=22866&atid=381174

Regards,
Adrian

>  
-- 
xxxxxxxxxxxxxxxxxxxxxxxx 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
xxxxxxxxxxxxxxxxxxxxxxxx 



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to