This could probably go in the
patterns forum...or
JSP... or... here?
Scenario:
You want to use a PreparedStatement to issue an INSERT statement somewhere in your application.
What if at some point you want to add another field to that tablename and modify the PreparedStatement?
What does the pattern look like if I want to create a Database Class that creates the connection, creates the datasource and handles the executeUpdate() part?
Should I encapsulate the Database Class into my business object, or do you encapsulate the Database Class into an intermediary class and then encapsulate the intermediary class into your business object?
Am I looking at a Factory pattern or a Data Access Object pattern? (that's not a quiz... I'm not looking at any patterns currently.)
Or should I just leave it alone and cram everything into one method in my business object that creates the connection, datasource, etc.? Something has to get recompiled anyway... (just read the evil design patterns by Paul...)
This is where I'm at.
I'm adding a PQIDBLog property to my business object and passing the PreparedStatment to this class. Yes, this is part of a web app. I want to log certain points of the web app to a database, rather than the server log files. Is this the right approach?