java - Anything wrong with using a DB wrapper Class like this? -


is there wrong using parent function handle messy catch/finally stuff in connection pool?

public connection getconnection() {     try {         return this.datasource.getconnection();     } catch (sqlexception e) {         // todo auto-generated catch block         e.printstacktrace();     }     return null; }  public resultset executequery(connection connection, preparedstatement stmt) {     try {         return stmt.executequery();     } catch (sqlexception e) {         // todo auto-generated catch block         e.printstacktrace();     } {         if (stmt != null) {             try {                 stmt.close();             } catch (sqlexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }         if (connection != null) {             try {                 connection.close();             } catch (sqlexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }     }     return null; } 

this example of facade pattern.

there's nothing wrong it, except should make methods static, (stateless) utility methods.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -