List of usage examples for org.apache.ibatis.session SqlSession update
int update(String statement, Object parameter);
From source file:org.solmix.datax.mybatis.MybatisDataService.java
License:Open Source License
protected DSResponse executeUpdate(DSRequest req, SqlSession session) throws DSCallException { DSResponse res = new DSResponseImpl(req, Status.STATUS_SUCCESS); String statement = getMybatisStatement(req); Object value = req.getRawValues(); int result = session.update(statement, value); res.setAffectedRows(new Integer(result)); res.setRawData(result);// w w w . j a v a 2 s .co m return res; }
From source file:org.solmix.datax.mybatis.MybatisDataService.java
License:Open Source License
protected Object executeWithSqlSession(SqlSession session, DSRequest req, OperationType type) { String statement = this.getMybatisStatement(req); if (DataTools.isFetch(type)) { return session.selectList(statement, req.getRawValues()); } else if (DataTools.isRemove(type)) { return session.delete(statement, req.getRawValues()); } else if (DataTools.isUpdate(type)) { return session.update(statement, req.getRawValues()); } else if (DataTools.isAdd(type)) { return session.insert(statement, req.getRawValues()); }/*from ww w . j av a 2s . co m*/ return null; }
From source file:pecosa.daoImpl.ConfirmadosDaoImpl.java
@Override public void guardarDistribucion(GuardarDistribucion p) { SqlSession session = sqlSessionFactory.openSession(); try {//from w w w.j a v a2 s .com session.update("Confirmados.guardar_distrib", p); session.commit(); } finally { session.close(); } }
From source file:pecosa.daoImpl.ConfirmadosDaoImpl.java
@Override public void actualizarDistribucion(Integer idDis, Integer cantidad) { Map<String, Integer> map = new HashMap<String, Integer>(); map.put("idDistrib", idDis); map.put("cantidad", cantidad); SqlSession session = sqlSessionFactory.openSession(); try {/* w w w . j ava 2 s . co m*/ session.update("Confirmados.update_distrib", map); session.commit(); } finally { session.close(); } }
From source file:pecosa.daoImpl.ConfirmadosDaoImpl.java
@Override public void actualizarDistribucion2(VerificarDistribucion verif) { SqlSession session = sqlSessionFactory.openSession(); try {/* w w w . j a v a 2 s. c om*/ session.update("Confirmados.update_distrib2", verif); session.commit(); } finally { session.close(); } }
From source file:pecosa.daoImpl.ConfirmadosDaoImpl.java
@Override public void modificarSBN(String sbn, Integer idNumero) { Map<String, Object> map = new HashMap<String, Object>(); map.put("sbn", sbn); map.put("idnumero", idNumero); SqlSession session = sqlSessionFactory.openSession(); try {/*from w w w . j ava 2 s .c o m*/ session.update("Confirmados.update_sbn", map); session.commit(); } finally { session.close(); } }
From source file:pecosa.daoImpl.DistribuidosDaoImpl.java
@Override public void confirmarSBN(String sbn, Integer idNumero) { System.out.println("SBN: " + sbn + " " + "Idnumero: " + idNumero); Map<String, Object> map = new HashMap<String, Object>(); map.put("sbn", sbn); map.put("idnumero", idNumero); SqlSession session = sqlSessionFactory.openSession(); try {/* w w w . ja va 2s . co m*/ session.update("Distribuidos.update_sbn", map); session.commit(); } finally { session.close(); } }
From source file:py.pol.una.ii.pw.service.MyControladorClientes.java
License:Apache License
public void actualizar(Clientes cliente) throws IOException { /*String resource = "mybatis/myBatisConfig.xml"; InputStream inputStream;/*from w w w. j a v a 2 s .com*/ inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); SqlSession session = sqlSessionFactory.openSession();*/ SqlSession session = sesiones.getSession(); try { session.update("mybatis.ClienteMapper.updateCliente", cliente); } finally { session.close(); } }
From source file:webim.dao.ibatis.WebimHistoryDao.java
License:Apache License
/** * with?MySQL:<br>/*from ww w. j a v a 2 s.c o m*/ * * "UPDATE webim_histories SET fromdel = 1 Where from = @0 and to = @1 and type = 'chat'" * <br> * "UPDATE webim_histories SET todel = 1 Where to = @0 and from = @1 and type = 'chat'" * <br> * "DELETE FROM webim_histories WHERE fromdel = 1 AND todel = 1" * * @param uid * uid * @param with * id,????long */ public void clearHistories(String uid, String with) { Map<String, String> params = new HashMap<String, String>(); params.put("uid", uid); params.put("with", with); SqlSession session = sessionFactory.openSession(); try { session.update("HistoryMapper.clearFromHistory", params); session.update("HistoryMapper.clearToHistory", params); session.delete("HistoryMapper.deleteHistory"); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } }
From source file:webim.dao.ibatis.WebimHistoryDao.java
License:Apache License
/** * ????MySQL:<br>/* w ww . jav a2s. co m*/ * * "UPDATE webim_histories SET send = 1 where to = ? and send = 0"); * * @param uid * uid */ public void offlineHistoriesReaded(String uid) { SqlSession session = sessionFactory.openSession(); try { session.update("HistoryMapper.offlineReaded", uid); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } }