jdbc
public ResultSet getList() { ResultSet rs = null; Statement stmt = null; Connection con = null; con = this.dbC.getConnection(); if (con != null) { try { stmt = con.createStatement(); if (stmt != null) { rs = stmt.executeQuery("select * from user"); if (rs != null) { return rs; } else { return null; } } else { return null; } } catch (SQLException e) { e.printStackTrace(); } } else { return null; } return rs; //标记 }finally { return null;}
[解决办法]
你可以写个通用的增、删、改、查方法,如果用到查询时,只须调用query的方法即可,
增、删、改也是如此,去看我的资源,有jdbc一般通用方法,hibernate通用方法
还有一些框架整合的项目