I'm participating in the process of migrating existing DAOs of a web application to use Spring for database interaction.
I am not sure which way is more efficient/fast: having an inner class inside the DAO which extends rowMapper for the SELECT statements, or perhaps having an inner class which extends MappingSqlQuery inside every method which executes a SELECT?
From the amount of code point of view, the first option seems more attractive, because if I have five methods that all fetch the same information from the result set, then they can all use the same class. However, the manner in which I have to call the rowMapper in this case:
List result = jt.query(SELECT_ACCOUNT_ON_ID, parms, parmsType, new AccountDAO().new ColumnRowMapper());
seems too complex and maybe even improper, because such call is executed inside a static method.
Any thoughts would be greatly appreciated.