Ranjan,
Sorry to bother you again. Have two quick questions that you probably
already answered for me but with all the threads I have saved I can't
seem to find it.
2 Questions after your post below...
On Thursday, May 16, 2002, 12:14:38 PM, Ranjan wrote:
PR> The way I do it is -
BO -->> DAO --->returns the recordset and not ValueObject. This RS is
BO -->> passed back to the BO. which passes it to the ValueObject to
BO -->> build it.
PR> The code will look something like this -
PR> public class BO
PR> {
PR> CustomerVO custvo = new CustomerVO();
PR> Recordset rs = dao.getCustomer(1);
PR> custvo.buildCustomerVo(rs);
PR> }
PR> One should not build VO in DAO because u will create dependency on
PR> the DAO. In case u want to separate DAO from the BO then the DAO
PR> alone will not work as it will have reference to the VO. So intead
PR> of being a lightweight DAO it will be a heavyweight component will
PR> lot of dependencies. Reuse will take hit with this approach but
PR> that just me.
PR> Ranjan.
1) Curious again how to best handle doing updates/inserts. What
would the DAO update/insert methods take as argument(s)? If your
BO above was modified ...
public class BO
{
CustomerVO getCustomer( int id ) {
CustomerVO custvo = new CustomerVO();
Recordset rs = dao.getCustomer( id );
custvo.buildCustomerVo(rs);
return custvo;
}
void insertCustomer( CustomerVO custvo ) {
dao.insertCustomer( ??? );
}
}
What would the insertCustomer take as an argument? Would it take a
Customer Value Object? ( If so wouldn't this mess with your
separation of not having the DAOs know about the Value Objects? )
2) Last question...
Where should the conversions to the correct datatypes be done?
Obviously before an insert is done I need to have the correct
datatypes, but I'm wondering if this is best taken care of in the
Value Object so that getters return the correct type (Date, etc)
or should the Value Objects just contain mostly Strings like the
Form Bean objects and then I guess the datatype conversion could
be done in the DAO?
Thanks so much for help with these two questions.
--
Rick
mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>