标签:
DAO事物函数模版
public void OrderFinsByPage(){ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = DBUtils.getConnection(); //事务开始 conn.setAutoCommit(false); //业务逻辑 conn.commit(); } catch (Exception e) { try { conn.rollback(); } catch (SQLException sqkex) { // TODO Auto-generated catch block sqkex.printStackTrace(); } e.printStackTrace(); }finally { try { conn.setAutoCommit(true); if(conn !=null) conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
标签:
原文地址:http://www.cnblogs.com/fengdashen/p/5076781.html