示例#1
0
 public boolean insertIntoUserHasCategories(UserHasCategory usHas) {
   try {
     Connection connection = PoolConnection.getConnection();
     try {
       connection.setAutoCommit(false);
       udao.insert(connection, usHas.getCategoryID(), usHas.getUserId());
       connection.commit();
     } catch (SQLTransactionException e) {
       connection.rollback();
       return false;
     } finally {
       if (connection != null) {
         connection.setAutoCommit(true);
         connection.close();
       }
     }
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return true;
 }