Vic, not sure if I'm getting your replies to the list, so if you reply to this could you reply to me as well. Thanks a lot!
On Mon, 17 Mar 2003 14:00:15 -0500 Vic Cekvenich <[EMAIL PROTECTED]> wrote: > and why baseBean has a > DAO helper is a best practice (amoung other things I showed). Is the DAO helper in the latest basicPortal? I haven't downloaded from CVS the very latest bp but am looking at the bp that you can download from basebeans.com and am not sure what represents the DAO helper in that application (if there is even an example of one there?). Using the RowSet approach, unless I'm wrong the DAO portion that has the get and set implementations are found in BasicDAOImpl: public String getProperty(String property) throws SQLException { Object obj = _rs.getString(property); //snip return obj.toString(); } public boolean setProperty(String property, Object value) throws SQLException { //snip _rs.updateObject(property, value); _rs.updateRow(); //snip } So back to the example I had earlier involving the form needs "annualSalary" and the db requires a "salaryPerWeek." Imagine we did a retrieveAll and wanted to display back the results to the user and we were still stuck having to use the db column salaryPerWeek yet we needed to display annual salary ( salaryPerWeek * 52 ) to the user. Each iteration would end up calling the dao getProperty(String prop) listed above. I'm wondering how the DAOhelper would work? I'm guessing here- but would it work as another layer in between the BasicDAOImpl and the FormBeanDAO (ie StoreDAO)? So for example the DAOhelper might have a method: DAOhelper extends BasicDAOImpl public String getProperty(String property) throws SQLException { String result = null; Object obj = _rs.getString(property); if ( property == Constants.ANNUAL_SALARY ) { result = SomeObject.calculateSalaryPerWeek( obj.toString() ); } else { result = super.getProperty( property ); } return result; } and then a similar setProperty method overriding the base BasicDAOImpl's setProperty(). What I like about the above approach is that it keeps you original BasicDAOImpl nice and clean as a representation of the db columns. The Helper would be one of those sort-of-ugly things you have to add to deal with the situations where the presentation doesn't match the db. I haven't seen an implementation of the helper class so I'm not at all certain this is even remotely what you would do:) It just seems like it should work. -- Rick Reumann _______________________________________________ MVC-Programmers mailing list [EMAIL PROTECTED] http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers