This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've got a connection pool and a class that has 2 methods: executeUpdate and executeQuery. Each of these methods' call uses a connection from the connection pool, a new prepared statement and a new result set. So, functionality is incapsulated in that class. Programmers will know only about xxx.executeUpdate(String query, ArrayList params) and xxx.executeQuery(String query, ArrayList params) that returns a resultSet. I have no problem with update, because i have no result sets at all. The problem is with closing the prepared statement in executeQuery.
Where could i close the prepared statement in the executeQuery? If i close it there in a ordinary way, the result set that should be returned is also closed.
If you think you've done too much, usually it means you've done too few.