> > 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
Mmm DO are only there for external world imho > or > b) pass a reference to the bean to the DAO. I prefer this > > 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. Often I develop BMP after developing corresponding CMP. That make the developement standalone easy. My DB with tables created by Jboss and my application works. Quick. Then when I need to integrate, I use BMP. One problem here is how about CMP relationships will move to DAO with DO. Sometimes my complete BMp is only one bean while on CMP I had many. For example : OrderCMP / OrderLineCMP ==> OrderBMP Then using the bean instead of DO makes the life easier because I most of business method a lot from CMP. > > 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. As Ara says Rickard plays with BMP just like thatvery easily. So I don't see a problem here. > > So, 2 questions: > 1) Do the fields need to be public, or should they be changed > to private? Public > Does 1.1 CMP require them to be public, or does it use the > getters/setters? Public > 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?) BEAN > > > Andrew. (aiming for perfection, as usual) > Recntly discussing with a collegue we break a little this DAO pattern. Why inheritence and specific implementation is not enough. I understand the need for DAO when doing non EJB access, but when running pure EJBs. WTF. Write multiple bean inherited from a base one and that is enough, then deploy the specific one you want. Now this remark can simply break what I said before, I mean refering the bean instead of the DO. When referring the DO you have DAO not linked to javax.ejb My 2 cents Vincent _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel