|
发表于 2014-11-5 10:12:58
|
显示全部楼层
- public static int saveDEMO_BookView(String concept,String dataModel,String fnModel,List<?> insertRange,List<?>deleteRange,List<?> updateRange,String readOnly,String notNull,Table table) throws NamingException, SQLException{
- // 获取JDBC的连接并开启事务(***注意如果不能处理异常就不要捕获异常)
- Connection conn = ModelUtils.getConnectionInTransaction("/demo/actions/data");
- Iterator<Row> rows = table.iterator();
- while (rows.hasNext()) {
- Row row = rows.next();
- ModifyState rowState = row.getState();
-
- int id = row.getInt("fBookID");
- String name = row.getString("fBookName");
- BigDecimal price = row.getDecimal("fPrice");
- String ISBN = row.getString("fISBN");
- Integer amount = row.getInteger("fAmount");
-
- if (ModifyState.NEW.equals(rowState)) {
- addBook(conn, id, name, price, ISBN);
- addBookStore(conn, id, amount);
- } else if (ModifyState.EDIT.equals(rowState)) {
- updateBook(conn, id, name, price, ISBN);
- updateBookStore(conn, id, amount);
- } else if (ModifyState.DELETE.equals(rowState)) {
- delBook(conn, id);
- delBookStore(conn, id);
- }
- }
-
- return table.size();
- // return BizData.save(table, concept, insertRange, deleteRange, updateRange, readOnly, notNull, dataModel, fnModel);
- }
复制代码 |
评分
-
查看全部评分
|