List of usage examples for org.apache.ibatis.session SqlSession insert
int insert(String statement);
From source file:com.baidu.oped.apm.plugin.mybatis.SqlSessionTestBase.java
License:Apache License
protected final void testAndVerifyInsertWithNullParameter() throws Exception { // Given//from w w w. j a va 2 s.co m SqlSession sqlSession = getSqlSession(); // When sqlSession.insert(null); // Then PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); Method insert = sqlSession.getClass().getDeclaredMethod("insert", String.class); verifier.verifyTrace(event("MYBATIS", insert)); }
From source file:com.baidu.oped.apm.plugin.mybatis.SqlSessionTestBase.java
License:Apache License
protected final void testAndVerifyInsert() throws Exception { // Given/*from w ww.ja v a 2 s. co m*/ final String insertId = "insertId"; SqlSession sqlSession = getSqlSession(); // When sqlSession.insert(insertId); sqlSession.insert(insertId, new Object()); // Then PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); Method insert1 = sqlSession.getClass().getDeclaredMethod("insert", String.class); Method insert2 = sqlSession.getClass().getDeclaredMethod("insert", String.class, Object.class); verifier.verifyTrace(event("MYBATIS", insert1, Expectations.cachedArgs(insertId))); verifier.verifyTrace(event("MYBATIS", insert2, Expectations.cachedArgs(insertId))); }
From source file:com.luxoft.mybatis.splitter.UpdateSplitterPluginTest.java
License:Apache License
public void splitterTest(ExecutorType execType) throws IOException, SQLException { SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder() .build(Resources.getResourceAsStream("configuration.xml")); SqlSession sqlSession = sqlSessionFactory.openSession(execType); sqlSession.insert("makeTable"); sqlSession.flushStatements();/*w w w . ja v a 2 s.co m*/ doInsert(sqlSession); Assert.assertEquals(Arrays.asList("first", "second", "third"), sqlSession.selectList("get")); sqlSession.insert("dropTable"); sqlSession.flushStatements(); sqlSession.close(); }
From source file:com.onnurimotors.wm.service.WmService.java
public String generateDB() { SqlSession session = sqlSession(); session.insert("watchman.mybatis.createEmployeeTable"); session.commit();/* ww w .j av a 2 s . co m*/ session.insert("watchman.mybatis.createManagementTable"); session.commit(); session.insert("watchman.mybatis.createHistoryManagementTable"); session.commit(); session.insert("watchman.mybatis.createVehicleTable"); session.commit(); session.insert("watchman.mybatis.createHistoryTable"); session.commit(); session.close(); return "Success"; }
From source file:com.onnurimotors.wm.service.WmService.java
public String regenerateDB() { SqlSession session = sqlSession(); session.delete("watchman.mybatis.dropManagementTable"); session.commit();// w w w.j a va 2 s.c o m session.delete("watchman.mybatis.dropHistoryManagementTable"); session.commit(); session.delete("watchman.mybatis.dropVehicleTable"); session.commit(); session.delete("watchman.mybatis.dropHistoryTable"); session.commit(); session.insert("watchman.mybatis.createManagementTable"); session.commit(); session.insert("watchman.mybatis.createHistoryManagementTable"); session.commit(); session.insert("watchman.mybatis.createVehicleTable"); session.commit(); session.insert("watchman.mybatis.createHistoryTable"); session.commit(); session.close(); return "Success"; }
From source file:com.onnurimotors.wm.service.WmService.java
public String modifyDB() { SqlSession session = sqlSession(); //session.update("watchman.mybatis.modifyEmployeeTable"); //session.commit(); session.delete("watchman.mybatis.dropEmployeeTable"); session.commit();/*w ww. j a v a2 s . c o m*/ session.insert("watchman.mybatis.createEmployeeTable"); session.commit(); session.close(); return "Success"; }
From source file:net.hasor.db.orm.mybatis3.SqlExecutorTemplate.java
License:Apache License
public int insert(final String statement) throws SQLException { return this.execute(new SqlSessionCallback<Integer>() { public Integer doSqlSession(SqlSession sqlSession) { return sqlSession.insert(statement); }/*from w w w. j ava2s . c om*/ }); }
From source file:net.nexxus.db.DBManagerImpl.java
License:Open Source License
/** * create Server group list table//from www . ja v a2 s . c om * @throws Exception */ public void createServerGroupList() throws Exception { SqlSession session = sqlFactory.openSession(); session.insert("createGroupListTable"); session.commit(); session.close(); }