This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
This could probably go in the patterns forum...or JSP... or... here?
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?