Any opinions on the best way to handle EJB lifecycle events through DAOs?  
I've got two main choices, and I'm not sure which way to jump:

a) use DataObjects to pass around the state values between the bean and the 
DAO
or
b) pass a reference to the bean to the DAO.

e.g. ejbLoad would either call dao.load(pk) which return a dataobject, and I 
then set the fields to the dataobject's values, or it calls dao.load(pk, 
this) and the DAO sets the fields itself.

The drawback to the first approach is that you must be using/generating the 
DataObject (or a DataObject containing all the persistent fields, once the 
fine-grained value object stuff is done), which may not be the case.

The drawback I anticipated with the second approach isn't actually a problem 
at the moment, but basically I had expected that it would require having 
getters (for the store method) and setters (for the load method) for every 
persistent field (which isn't currently the case in some of my EJBs that 
have read-only fields).  This was because I assumed the actual fields in the 
BMP subclass would be private (or at least wouldn't be public), so I 
wouldn't be able to change them directly.  However, looking at 
entity-cmp11.j, I see that they're currently declared as public.

So, 2 questions:
1) Do the fields need to be public, or should they be changed to private?  
Does 1.1 CMP require them to be public, or does it use the getters/setters?  
If it does need them public, should we use separate code for BMP that 
declares them private instead?

2) Which way is better for the DAOs?  Dataobjects or references to the bean? 
(and does it depend on the answer to 1?)


Andrew. (aiming for perfection, as usual)

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to