@Override public void modificar(MotInteInventario inteInventario) throws MotInteInventarioDaoException { Connection conn = null; CallableStatement stmt = null; try { conn = ResourceManager.getConnection(); stmt = conn.prepareCall("{call SP_MOT_UPD_INTE_INVENTARIO;1(?,?,?,?)}"); stmt.setLong(1, inteInventario.getInternamiento().getIntcodigoD()); stmt.setInt(2, inteInventario.getInventarioTipo().getBitcodigoI()); stmt.setString(3, inteInventario.getBivestadoC()); stmt.setInt(4, inteInventario.getBivcantidadI()); stmt.execute(); } catch (SQLException e) { throw new MotInteInventarioDaoException(e.getMessage(), e); } finally { ResourceManager.close(stmt); ResourceManager.close(conn); } }
@Override public void insertar(MotInteInventario inteInventario) throws MotInteInventarioDaoException { Connection conn = null; CallableStatement stmt = null; try { conn = ResourceManager.getConnection(); stmt = conn.prepareCall("{call SP_MOT_INS_INTE_INVENTARIO;1(?,?,?,?,?)}"); stmt.registerOutParameter(1, Types.DECIMAL); stmt.setLong(2, inteInventario.getInternamiento().getIntcodigoD()); stmt.setInt(3, inteInventario.getInventarioTipo().getBitcodigoI()); stmt.setString(4, inteInventario.getBivestadoC()); stmt.setInt(5, inteInventario.getBivcantidadI()); stmt.execute(); Long codigo = stmt.getLong(1); if (codigo != null) { inteInventario.setBivcodigoD(codigo); } } catch (SQLException e) { throw new MotInteInventarioDaoException(e.getMessage(), e); } finally { ResourceManager.close(stmt); ResourceManager.close(conn); } }