Package org.apache.ibatis.session

Examples of org.apache.ibatis.session.SqlSession.commit()


                    SqlSessionTemplate.this.executorType,
                    SqlSessionTemplate.this.exceptionTranslator);
            try {
                Object result = method.invoke(sqlSession, args);
                if (!SqlSessionUtils.isSqlSessionTransactional(sqlSession, SqlSessionTemplate.this.sqlSessionFactory)) {
                    sqlSession.commit();
                }
                return result;
            } catch (Throwable t) {
                Throwable unwrapped = ExceptionUtil.unwrapThrowable(t);
                if (SqlSessionTemplate.this.exceptionTranslator != null && unwrapped instanceof PersistenceException) {
View Full Code Here


      try {
        Object result = method.invoke(sqlSession, args);
        if (!isSqlSessionTransactional(sqlSession, SqlSessionTemplate.this.sqlSessionFactory)) {
          // force commit even on non-dirty sessions because some databases require
          // a commit/rollback before calling close()
          sqlSession.commit(true);
        }
        return result;
      } catch (Throwable t) {
        Throwable unwrapped = unwrapThrowable(t);
        if (SqlSessionTemplate.this.exceptionTranslator != null && unwrapped instanceof PersistenceException) {
View Full Code Here

                }
                result = session.insert(statement);
                doProcessResult(exchange, result);
            }
        } finally {
            session.commit();
            session.close();
        }
    }

    private void doUpdate(Exchange exchange) throws Exception {
View Full Code Here

                }
                result = session.update(statement);
                doProcessResult(exchange, result);
            }
        } finally {
            session.commit();
            session.close();
        }
    }

    private void doDelete(Exchange exchange) throws Exception {
View Full Code Here

                }
                result = session.delete(statement);
                doProcessResult(exchange, result);
            }
        } finally {
            session.commit();
            session.close();
        }
    }

    private void doProcessResult(Exchange exchange, Object result) {
View Full Code Here

                result = session.insert(statement);
                doProcessResult(exchange, result);
            }
        } finally {
            try {
                session.commit();
            } finally {
                session.close();               
            }
        }
    }
View Full Code Here

                result = session.update(statement);
                doProcessResult(exchange, result);
            }
        } finally {
            try {
                session.commit();
            } finally {
                session.close();               
            }
        }
    }
View Full Code Here

                result = session.delete(statement);
                doProcessResult(exchange, result);
            }
        } finally {
            try {
                session.commit();
            } finally {
                session.close();               
            }
        }
    }
View Full Code Here

        String[] statements = consumeStatements.split(",");
        try {
            for (String statement : statements) {
                session.update(statement.trim(), data);
            }
            session.commit();
        } catch (Exception e) {
            session.rollback();
            throw e;
        } finally {
            session.close();
View Full Code Here

    public List<?> poll(MyBatisConsumer consumer, MyBatisEndpoint endpoint) throws Exception {
        SqlSession session = endpoint.getSqlSessionFactory().openSession();
        try {
            List<Object> objects = session.selectList(endpoint.getStatement(), null);
            session.commit();
            return objects;
        } catch (Exception e) {
            session.rollback();
            throw e;
        } finally {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.