List of usage examples for org.apache.ibatis.session SqlSession commit
void commit();
From source file:com.onnurimotors.wm.service.WmService.java
private void deleteHistoryManagement(HISTORY_MANAGEMENT hm) { SqlSession session = sqlSession(); session.delete("watchman.mybatis.deleteHistoryManagement", hm); session.commit(); session.close();/*from ww w.jav a 2 s. co m*/ }
From source file:com.onnurimotors.wm.service.WmService.java
public Object toggleReceivingKakao(HttpServletRequest request) { SqlSession session = sqlSession(); EMPLOYEE employee = new EMPLOYEE(); String is_receiving_kakao = request.getParameter("IS_RECEIVING_KAKAO"); employee.setEMPLOYEE_ID(Integer.parseInt(request.getParameter("EMPLOYEE_ID"))); if (is_receiving_kakao.equals("on")) { employee.setIS_RECEIVING_KAKAO(0); } else {/*from ww w . ja va 2 s. c om*/ employee.setIS_RECEIVING_KAKAO(1); } session.update("watchman.mybatis.updateEmployeeIsReceivingKakao", employee); session.commit(); session.close(); return employee; }
From source file:com.onnurimotors.wm.service.WmService.java
public String generateDB() { SqlSession session = sqlSession(); session.insert("watchman.mybatis.createEmployeeTable"); session.commit(); session.insert("watchman.mybatis.createManagementTable"); session.commit();/*from w w w .ja v a 2 s .com*/ 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(); session.delete("watchman.mybatis.dropHistoryManagementTable"); session.commit();/*from w ww . ja va 2s .c o m*/ 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(); session.insert("watchman.mybatis.createEmployeeTable"); session.commit();//from w ww. j a v a2 s.c om session.close(); return "Success"; }
From source file:com.skt.adcas.lte.action.CSVDownloadAction.java
public String selectBasicData() { this.log.debug("selectBasicData Start"); SqlSession session = null; try {/* w w w .ja v a 2s .co m*/ parseParam(); session = SqlSessionManager.getSqlSession().openSession(); String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH"); String tempFolder = "/" + UUID.randomUUID().toString(); String xlsFileName = "/nice.csv"; String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName; log.debug(xlsFileFullPath); if (!(new File(writeFolderPath + tempFolder)).mkdir()) { throw new Exception("? ?? ."); } //this.fileOut = new FileOutputStream(xlsFileFullPath); FileOutputStream fos = new FileOutputStream(xlsFileFullPath); OutputStreamWriter osw = new OutputStreamWriter(fos, "EUC-KR"); this.fileOut = new BufferedWriter(osw); //this.fileOut = new BufferedWriter(new FileWriter(xlsFileFullPath)); writeHeader(); log.debug(param); session.select("BigDownload.selectBasicData_" + param.get("SEARCHTYPE"), param, this); fileOut.close(); this.msg = "? ? ?"; this.status = "SUCCESS"; this.downloadurl = /*"download" + */ tempFolder + xlsFileName; session.commit(); this.msg = "??"; this.status = "SUCCESS"; } catch (Exception e) { e.printStackTrace(); this.msg = e.getMessage(); this.status = "ERROR"; this.error = true; session.rollback(); } finally { session.close(); } return SUCCESS; }
From source file:com.softsimphony.checadorgdf.services.ReporteService.java
/** * Metodo para insertar un registro en la tabla Reporte de la base de datos * @param reporte //from w w w . j ava 2 s . co m */ public int insertar(Reporte reporte) throws IOException { SqlSession session = null; try { session = AccesoChecadorGDF_BD.obtenerConexion(); reporteMapper = session.getMapper(ReporteMapper.class); reporteMapper.insert(reporte); session.commit(); return reporte.getIdReporte(); } finally { if (session != null) session.close(); } }
From source file:com.softsimphony.checadorgdf.services.ReporteService.java
/** * Actualiza un registro de la tabla reporte apartir del idReporte * @param reporte // w w w. j a va2 s. c o m */ public void actualizar(Reporte reporte) throws IOException { SqlSession session = null; try { session = AccesoChecadorGDF_BD.obtenerConexion(); reporteMapper = session.getMapper(ReporteMapper.class); reporteMapper.updateByPrimaryKey(reporte); session.commit(); } finally { if (session != null) session.close(); } }
From source file:com.softsimphony.checadorgdf.services.ReporteService.java
public void eliminar(int idReporte) throws IOException { SqlSession session = null; try {//from ww w. ja v a 2s .co m session = AccesoChecadorGDF_BD.obtenerConexion(); reporteMapper = session.getMapper(ReporteMapper.class); reporteMapper.deleteByPrimaryKey(idReporte); session.commit(); } finally { if (session != null) session.close(); } }
From source file:com.softsimphony.checadorgdf.services.UsuarioService.java
/** * Metodo para insertar un registro en la tabla Usuario de la base de datos * @param usuario /*from w w w . j a va2s .co m*/ */ public int insertar(Usuario usuario) throws IOException { SqlSession session = null; try { session = AccesoChecadorGDF_BD.obtenerConexion(); usuarioMapper = session.getMapper(UsuarioMapper.class); usuarioMapper.insert(usuario); session.commit(); return usuario.getIdUsuario(); } finally { if (session != null) session.close(); } }