I am working on legacy java/j2ee project which is using Servlets/JSP/JDBC, it has been evolving since long hence there is no framework involved. However we have followed command pattern for servlets and done same basic application of OOP's concepts. We don't have Service layer nor the DAO layer . Below is the basic design of application.
All servlets extend a base servlet , This base Servlet holds the DB connection variable ( which is a instance variable) . All the Beans(VO's) hold the code for getting data from DB too along with Setter and getter code . Each Bean has connection variable ( instance variable)
Each time a servlet gets invoked it calls the Super servlet to get connection object ( the servlet get the connection object using DB-util class using Data-source) and when servlet wants to get any data from DB it calls the respective Bean and sets the connection object and the bean performs all the DB operation using plain old JDBC code once the Bean is done with fetching of data and control goes back to servlet the servlet closes the connection before forwarding to JSP.
Now I want to improve the design , I know i can bring in service/DAO layer but this is time consuming as the application has about 300-400 Beans ( we also have 300 tables) this would take at-least 3-4 months with 5-10 resources .
Is there a way by which i can improve the DB connection code and reduce JDBC boiler plate code by not bringing in the Service layer /DAO layer .
Aucun commentaire:
Enregistrer un commentaire