Example usage for java.sql CallableStatement getObject

List of usage examples for java.sql CallableStatement getObject

Introduction

In this page you can find the example usage for java.sql CallableStatement getObject.

Prototype

Object getObject(String parameterName) throws SQLException;

Source Link

Document

Retrieves the value of a parameter as an Object in the Java programming language.

Usage

From source file:com.mimp.hibernate.HiberNna.java

public Nna getNna(long id) {
    Session session = sessionFactory.getCurrentSession();
    final Nna tempnna = new Nna();
    final Long idnna = id;

    Work work = new Work() {
        @Override//  www  . j a v a 2  s.  co  m
        public void execute(Connection connection) throws SQLException {
            ExpedienteNna expnna;
            Juzgado juz;
            Car car;

            String hql = "{call HN_GET_NNA(?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idnna);
            statement.registerOutParameter(2, OracleTypes.CURSOR);
            statement.execute();

            temp = (ResultSet) statement.getObject(2);

            while (temp.next()) {
                tempnna.setIdnna(idnna);
                juz = new Juzgado();
                juz.setIdjuzgado(temp.getLong("IDJUZGADO"));
                tempnna.setJuzgado(juz);
                tempnna.setNombre(temp.getString(2));
                tempnna.setApellidoP(temp.getString(3));
                tempnna.setApellidoM(temp.getString(4));
                tempnna.setSexo(temp.getString(5));
                tempnna.setFechaNacimiento(temp.getDate(6));
                tempnna.setEdadAnhos(temp.getShort(7));
                tempnna.setEdadMeses(temp.getShort(8));
                tempnna.setActaNacimiento(temp.getShort(9));
                tempnna.setCondicionSalud(temp.getString(10));
                tempnna.setDepartamentoNacimiento(temp.getString(11));
                tempnna.setProvinciaNacimiento(temp.getString(12));
                tempnna.setDistritoNacimiento(temp.getString(13));
                tempnna.setPaisNacimiento(temp.getString(14));
                tempnna.setLugarNac(temp.getString(15));
                tempnna.setFechaResolAbandono(temp.getDate(16));
                tempnna.setFechaResolConsentida(temp.getDate("FECHA_RESOL_CONSENTIDA"));
                tempnna.setClasificacion(temp.getString(18));
                tempnna.setIncesto(temp.getShort(19));
                tempnna.setMental(temp.getShort(20));
                tempnna.setEpilepsia(temp.getShort(21));
                tempnna.setAbuso(temp.getShort(22));
                tempnna.setSifilis(temp.getShort(23));
                tempnna.setSeguiMedico(temp.getShort(24));
                tempnna.setOperacion(temp.getShort(25));
                tempnna.setHiperactivo(temp.getShort(26));
                tempnna.setEspecial(temp.getShort(27));
                tempnna.setEnfermo(temp.getShort(28));
                tempnna.setMayor(temp.getShort(29));
                tempnna.setAdolescente(temp.getShort(30));
                tempnna.setHermano(temp.getShort(31));
                tempnna.setNn(temp.getShort(32));
                tempnna.setObservaciones(temp.getString(33));
                tempnna.setNResolAband(temp.getString(34));
                tempnna.setNResolCons(temp.getString("N_RESOL_CONS"));
                try {
                    expnna = getExpNna(tempnna.getIdnna());
                    if (expnna.getIdexpedienteNna() != 0) {
                        Set<ExpedienteNna> listexp = new HashSet<ExpedienteNna>();
                        listexp.add(expnna);
                        tempnna.setExpedienteNnas(listexp);
                    }
                } catch (Exception e) {

                }
                car = new Car();
                car.setIdcar(temp.getLong("IDCAR"));
                car.setNombre(temp.getString(37));
                car.setDireccion(temp.getString(38));
                car.setDepartamento(temp.getString(39));
                car.setProvincia(temp.getString(40));
                car.setDistrito(temp.getString(41));
                car.setDirector(temp.getString(42));
                car.setContacto(temp.getString(43));
                car.setCorreo(temp.getString(44));
                car.setFax(temp.getString(45));
                car.setCelular(temp.getString(46));
                car.setTelefono(temp.getString(47));
                car.setObservaciones(temp.getString(48));
                tempnna.setCar(car);
            }
            temp.close();
            statement.close();
        }
    };
    session.doWork(work);

    return tempnna;
}

From source file:com.mimp.hibernate.HiberNna.java

public ExpedienteNna getExpNna(long idNna) {
    Session session = sessionFactory.getCurrentSession();

    final ExpedienteNna expnna = new ExpedienteNna();
    final Long idnna = idNna;

    Work work = new Work() {
        @Override/*from ww  w  .ja  v a  2s  . c  o m*/
        public void execute(Connection connection) throws SQLException {
            Nna tempnna;

            String hql = "{call HN_GET_EXPEDIENTE_NNA_UNO(?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idnna);
            statement.registerOutParameter(2, OracleTypes.CURSOR);
            statement.execute();

            tempexp = (ResultSet) statement.getObject(2);

            while (tempexp.next()) {
                expnna.setIdexpedienteNna(tempexp.getLong(1));
                expnna.setNumero(tempexp.getString(2));
                expnna.setFechaIngreso(tempexp.getDate(3));
                expnna.setHt(tempexp.getString(4));
                expnna.setNExpTutelar(tempexp.getString(5));
                expnna.setProcTutelar(tempexp.getString(6));
                expnna.setFichaIntegral(tempexp.getShort(7));
                expnna.setComentarios(tempexp.getString(8));
                expnna.setRespLegalNombre(tempexp.getString(9));
                expnna.setRespLegalP(tempexp.getString(10));
                expnna.setRespLegalM(tempexp.getString(11));
                expnna.setRespPsicosocialNombre(tempexp.getString(12));
                expnna.setRespPiscosocialP(tempexp.getString(13));
                expnna.setRespPsicosocialM(tempexp.getString(14));
                expnna.setEstado(tempexp.getString(15));
                expnna.setFechaEstado(tempexp.getDate(16));
                expnna.setAdoptable(tempexp.getShort(17));
                expnna.setFechaResolCons(tempexp.getDate(18));
                expnna.setNacional(tempexp.getShort(19));
                expnna.setDiagnostico(tempexp.getString(20));
                expnna.setCodigoReferencia(tempexp.getString(21));
                expnna.setNActual(tempexp.getString(22));
                expnna.setApellidopActual(tempexp.getString(23));
                expnna.setApellidomActual(tempexp.getString(24));
                expnna.setObservaciones(tempexp.getString(25));
                expnna.setFechaInvTutelar(tempexp.getDate(26));
                expnna.setFechaIngPrio(tempexp.getDate("FECHA_ING_PRIO"));
                expnna.setFechaActualizacion(tempexp.getDate("FECHA_ACTUALIZACION"));
                tempnna = new Nna();
                tempnna.setIdnna(tempexp.getLong(27));
                tempnna.setNombre(tempexp.getString(28));
                tempnna.setApellidoP(tempexp.getString(29));
                tempnna.setApellidoM(tempexp.getString(30));
                tempnna.setSexo(tempexp.getString(31));
                tempnna.setFechaNacimiento(tempexp.getDate(32));
                tempnna.setEdadAnhos(tempexp.getShort(33));
                tempnna.setEdadMeses(tempexp.getShort(34));
                tempnna.setActaNacimiento(tempexp.getShort(35));
                tempnna.setCondicionSalud(tempexp.getString(36));
                tempnna.setDepartamentoNacimiento(tempexp.getString(37));
                tempnna.setProvinciaNacimiento(tempexp.getString(38));
                tempnna.setDistritoNacimiento(tempexp.getString(39));
                tempnna.setPaisNacimiento(tempexp.getString(40));
                tempnna.setLugarNac(tempexp.getString(41));
                tempnna.setFechaResolAbandono(tempexp.getDate(42));
                tempnna.setFechaResolConsentida(tempexp.getDate(43));
                tempnna.setClasificacion(tempexp.getString(44));
                tempnna.setIncesto(tempexp.getShort(45));
                tempnna.setMental(tempexp.getShort(46));
                tempnna.setEpilepsia(tempexp.getShort(47));
                tempnna.setAbuso(tempexp.getShort(48));
                tempnna.setSifilis(tempexp.getShort(49));
                tempnna.setSeguiMedico(tempexp.getShort(50));
                tempnna.setOperacion(tempexp.getShort(51));
                tempnna.setHiperactivo(tempexp.getShort(52));
                tempnna.setEspecial(tempexp.getShort(53));
                tempnna.setEnfermo(tempexp.getShort(54));
                tempnna.setMayor(tempexp.getShort(55));
                tempnna.setAdolescente(tempexp.getShort(56));
                tempnna.setHermano(tempexp.getShort(57));
                tempnna.setNn(tempexp.getShort(58));
                tempnna.setObservaciones(tempexp.getString(59));
                tempnna.setNResolAband(tempexp.getString(60));
                tempnna.setNResolCons(tempexp.getString(61));
                expnna.setNna(tempnna);
                Unidad unid = new Unidad();
                unid.setIdunidad(tempexp.getLong(62));
                expnna.setUnidad(unid);
            }
            tempexp.close();
            statement.close();
        }
    };
    session.doWork(work);
    return expnna;
}

From source file:com.mimp.hibernate.HiberNna.java

public Nna getNnaPostAdopcion(long id) {
    Session session = sessionFactory.getCurrentSession();

    final Nna tempnna = new Nna();
    final Long idnna = id;

    Work work = new Work() {
        @Override//from w ww.  j a  va  2s . co  m
        public void execute(Connection connection) throws SQLException {
            ExpedienteNna expnna;
            Car car;
            Juzgado juz;

            String hql = "{call HN_GET_NNA_POST(?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idnna);
            statement.registerOutParameter(2, OracleTypes.CURSOR);
            statement.execute();

            temp = (ResultSet) statement.getObject(2);

            while (temp.next()) {
                tempnna.setIdnna(idnna);
                tempnna.setNombre(temp.getString(1));
                tempnna.setApellidoP(temp.getString(2));
                tempnna.setApellidoM(temp.getString(3));
                tempnna.setSexo(temp.getString(4));
                tempnna.setFechaNacimiento(temp.getDate(5));
                tempnna.setEdadAnhos(temp.getShort(6));
                tempnna.setEdadMeses(temp.getShort(7));
                tempnna.setActaNacimiento(temp.getShort(8));
                tempnna.setCondicionSalud(temp.getString(9));
                tempnna.setDepartamentoNacimiento(temp.getString(10));
                tempnna.setProvinciaNacimiento(temp.getString(11));
                tempnna.setDistritoNacimiento(temp.getString(12));
                tempnna.setPaisNacimiento(temp.getString(13));
                tempnna.setLugarNac(temp.getString(14));
                tempnna.setFechaResolAbandono(temp.getDate(15));
                tempnna.setFechaResolConsentida(temp.getDate(16));
                tempnna.setClasificacion(temp.getString(17));
                tempnna.setIncesto(temp.getShort(18));
                tempnna.setMental(temp.getShort(19));
                tempnna.setEpilepsia(temp.getShort(20));
                tempnna.setAbuso(temp.getShort(21));
                tempnna.setSifilis(temp.getShort(22));
                tempnna.setSeguiMedico(temp.getShort(23));
                tempnna.setOperacion(temp.getShort(24));
                tempnna.setHiperactivo(temp.getShort(25));
                tempnna.setEspecial(temp.getShort(26));
                tempnna.setEnfermo(temp.getShort(27));
                tempnna.setMayor(temp.getShort(28));
                tempnna.setAdolescente(temp.getShort(29));
                tempnna.setHermano(temp.getShort(30));
                tempnna.setNn(temp.getShort(31));
                tempnna.setObservaciones(temp.getString(32));
                tempnna.setNResolAband(temp.getString(33));
                tempnna.setNResolCons(temp.getString(34));
                try {
                    expnna = getExpNna(tempnna.getIdnna());
                    if (expnna.getIdexpedienteNna() != 0) {
                        Set<ExpedienteNna> listexp = new HashSet<ExpedienteNna>();
                        listexp.add(expnna);
                        tempnna.setExpedienteNnas(listexp);
                    }
                } catch (Exception e) {

                }
                car = new Car();
                car.setIdcar(temp.getLong(35));
                car.setNombre(temp.getString(36));
                car.setDireccion(temp.getString(37));
                car.setDepartamento(temp.getString(38));
                car.setProvincia(temp.getString(39));
                car.setDistrito(temp.getString(40));
                car.setDirector(temp.getString(41));
                car.setContacto(temp.getString(42));
                car.setCorreo(temp.getString(43));
                car.setFax(temp.getString(44));
                car.setCelular(temp.getString(45));
                car.setTelefono(temp.getString(46));
                car.setObservaciones(temp.getString(47));
                tempnna.setCar(car);
                juz = new Juzgado();
                juz.setIdjuzgado(temp.getLong("IDJUZGADO"));
                juz.setNombre(temp.getString(49));
                juz.setDenominacion(temp.getString(50));
                juz.setEspecialidad(temp.getString(51));
                juz.setDireccion(temp.getString(52));
                juz.setDepartamento(temp.getString(53));
                juz.setCorteSuperior(temp.getString(54));
                juz.setDistritoJudicial(temp.getString(55));
                juz.setNombreJuez(temp.getString(56));
                juz.setTelefono(temp.getString(57));
                juz.setCorreo(temp.getString(58));
                juz.setObservaciones(temp.getString(59));
                tempnna.setJuzgado(juz);
            }
            temp.close();
            statement.close();
        }
    };
    session.doWork(work);
    return tempnna;
}

From source file:com.mimp.hibernate.HiberNna.java

public ArrayList<Nna> ListaNnaSeguimiento(String clasificacion) {
    Session session = sessionFactory.getCurrentSession();
    final String clasif = clasificacion;
    final ArrayList<Nna> allNna = new ArrayList();
    final ArrayList<Nna> allNnaAux = new ArrayList();
    final ArrayList<Nna> allNnaFinal = new ArrayList();

    Work work = new Work() {
        @Override/*ww w .j  a  v  a2  s.com*/
        public void execute(Connection connection) throws SQLException {
            ExpedienteNna expnna;
            Nna tempnna;
            Designacion desig;

            EstudioCaso est;

            String hql = "{call HN_GET_NNA_SEG(?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.registerOutParameter(1, OracleTypes.CURSOR);
            statement.execute();

            temp = (ResultSet) statement.getObject(1);

            while (temp.next()) {
                tempnna = new Nna();
                tempnna.setIdnna(temp.getLong(1));
                tempnna.setNombre(temp.getString(2));
                tempnna.setApellidoP(temp.getString(3));
                tempnna.setApellidoM(temp.getString(4));
                tempnna.setSexo(temp.getString(5));
                tempnna.setFechaNacimiento(temp.getDate(6));
                tempnna.setEdadAnhos(temp.getShort(7));
                tempnna.setEdadMeses(temp.getShort(8));
                tempnna.setActaNacimiento(temp.getShort(9));
                tempnna.setCondicionSalud(temp.getString(10));
                tempnna.setDepartamentoNacimiento(temp.getString(11));
                tempnna.setProvinciaNacimiento(temp.getString(12));
                tempnna.setDistritoNacimiento(temp.getString(13));
                tempnna.setPaisNacimiento(temp.getString(14));
                tempnna.setLugarNac(temp.getString(15));
                tempnna.setFechaResolAbandono(temp.getDate(16));
                tempnna.setFechaResolConsentida(temp.getDate(17));
                tempnna.setClasificacion(temp.getString(18));
                tempnna.setIncesto(temp.getShort(19));
                tempnna.setMental(temp.getShort(20));
                tempnna.setEpilepsia(temp.getShort(21));
                tempnna.setAbuso(temp.getShort(22));
                tempnna.setSifilis(temp.getShort(23));
                tempnna.setSeguiMedico(temp.getShort(24));
                tempnna.setOperacion(temp.getShort(25));
                tempnna.setHiperactivo(temp.getShort(26));
                tempnna.setEspecial(temp.getShort(27));
                tempnna.setEnfermo(temp.getShort(28));
                tempnna.setMayor(temp.getShort(29));
                tempnna.setAdolescente(temp.getShort(30));
                tempnna.setHermano(temp.getShort(31));
                tempnna.setNn(temp.getShort(32));
                tempnna.setObservaciones(temp.getString(33));
                tempnna.setNResolAband(temp.getString(34));
                tempnna.setNResolCons(temp.getString(35));
                try {
                    expnna = getExpNna(temp.getLong(1));
                    if (expnna.getIdexpedienteNna() != 0) {
                        Set<ExpedienteNna> listexp = new HashSet<ExpedienteNna>();
                        listexp.add(expnna);
                        tempnna.setExpedienteNnas(listexp);
                    }
                } catch (Exception e) {

                }
                allNnaAux.add(tempnna);
            }
            statement.close();
            temp.close();

            //AQUI DESIGNACIONES Y ESTUDIO DE CASOS EN CASO SEA PRIORITARIO
            for (Nna auxnna : allNnaAux) {
                Set<Designacion> listDesig = new HashSet<Designacion>();
                String hql2 = "{call HN_GET_DESIGNACIONES(?,?)}";
                CallableStatement statement2 = connection.prepareCall(hql2);
                statement2.setLong(1, auxnna.getIdnna());
                statement2.registerOutParameter(2, OracleTypes.CURSOR);
                statement2.execute();

                ResultSet rs2 = (ResultSet) statement2.getObject(2);
                while (rs2.next()) {
                    desig = new Designacion();
                    desig.setIddesignacion(rs2.getLong(1));
                    desig.setNDesignacion(rs2.getString(5));
                    desig.setPrioridad(rs2.getLong(6));
                    desig.setFechaPropuesta(rs2.getDate(7));
                    desig.setFechaConsejo(rs2.getDate(8));
                    desig.setAceptacionConsejo(rs2.getShort(9));
                    desig.setTipoPropuesta(rs2.getString(10));
                    desig.setObs(rs2.getString(11));
                    listDesig.add(desig);
                }
                auxnna.setDesignacions(listDesig);
                allNna.add(auxnna);
                statement2.close();
                rs2.close();
            }

            for (Nna auxnna : allNna) {
                if (auxnna.getClasificacion().equals("prioritario")) {
                    Set<EstudioCaso> listEst = new HashSet<EstudioCaso>();
                    String hql3 = "{call HN_GET_ESTUDIOS_CASO(?,?)}";
                    CallableStatement statement3 = connection.prepareCall(hql3);
                    statement3.setLong(1, auxnna.getIdnna());
                    statement3.registerOutParameter(2, OracleTypes.CURSOR);
                    statement3.execute();

                    ResultSet rs3 = (ResultSet) statement3.getObject(2);
                    while (rs3.next()) {
                        est = new EstudioCaso();
                        est.setIdestudioCaso(rs3.getLong(1));
                        est.setOrden(rs3.getString(4));
                        est.setFechaEstudio(rs3.getDate(5));
                        est.setFechaSolAdop(rs3.getDate(6));
                        est.setResultado(rs3.getString(7));
                        est.setPrioridad(rs3.getLong(8));
                        est.setNSolicitud(rs3.getLong(9));
                        listEst.add(est);
                    }
                    auxnna.setEstudioCasos(listEst);
                    statement3.close();
                    rs3.close();
                }
                allNnaFinal.add(auxnna);
            }

            //METODO BUBBLESORT PARA ORDENAR POR CODIGO
            if (clasif.equals("prioritario")) {
                Nna auxnna2;
                int n = allNnaFinal.size();
                for (int i = 0; i < n - 1; i++) {
                    for (int j = i; j < n - 1; j++) {
                        if (allNnaFinal.get(i).getExpedienteNnas().isEmpty()) {
                            if (!allNnaFinal.get(j + 1).getExpedienteNnas().isEmpty()) {
                                auxnna2 = allNnaFinal.get(i);
                                allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                allNnaFinal.set(j + 1, auxnna2);
                            } else {
                                String apellidoPrev = "";
                                String apellidoNext = "";
                                try {
                                    apellidoPrev = allNnaFinal.get(i).getApellidoP();
                                    if (apellidoPrev == null) {
                                        apellidoPrev = "";
                                    }
                                } catch (Exception ex) {
                                    apellidoPrev = "";
                                }
                                try {
                                    apellidoNext = allNnaFinal.get(j + 1).getApellidoP();
                                    if (apellidoNext == null) {
                                        apellidoNext = "";
                                    }
                                } catch (Exception ex) {
                                    apellidoNext = "";
                                }
                                if (apellidoPrev.compareToIgnoreCase(apellidoNext) > 0) {
                                    auxnna2 = allNnaFinal.get(i);
                                    allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                    allNnaFinal.set(j + 1, auxnna2);
                                }
                            }
                        } else {
                            Set<ExpedienteNna> listExp1 = allNnaFinal.get(i).getExpedienteNnas();
                            Set<ExpedienteNna> listExp2 = allNnaFinal.get(j + 1).getExpedienteNnas();
                            if (!listExp2.isEmpty()) {
                                for (ExpedienteNna exp1 : listExp1) {
                                    for (ExpedienteNna exp2 : listExp2) {
                                        String codant = exp1.getCodigoReferencia();
                                        String codpost = exp2.getCodigoReferencia();
                                        if (codant == null) {
                                            codant = "";
                                        }
                                        if (codpost == null) {
                                            codpost = "";
                                        }
                                        if (codant.compareToIgnoreCase(codpost) > 0) {
                                            auxnna2 = allNnaFinal.get(i);
                                            allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                            allNnaFinal.set(j + 1, auxnna2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    };
    session.doWork(work);

    return allNnaFinal;
}

From source file:com.mimp.hibernate.HiberNna.java

public ArrayList<Nna> ListaNnaPrioritarios(String clasificacion) {
    Session session = sessionFactory.getCurrentSession();
    final String clasif = clasificacion;
    final ArrayList<Nna> allNna = new ArrayList();
    final ArrayList<Nna> allNnaAux = new ArrayList();
    final ArrayList<Nna> allNnaFinal = new ArrayList();

    Work work = new Work() {
        @Override//from   www  . j  a va 2 s.co m
        public void execute(Connection connection) throws SQLException {
            ExpedienteNna expnna;
            Nna tempnna;
            Designacion desig;

            EstudioCaso est;

            String hql = "{call HN_GET_NNA_PRIO(?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.registerOutParameter(1, OracleTypes.CURSOR);
            statement.execute();

            temp = (ResultSet) statement.getObject(1);

            while (temp.next()) {
                tempnna = new Nna();
                tempnna.setIdnna(temp.getLong(1));
                tempnna.setNombre(temp.getString(2));
                tempnna.setApellidoP(temp.getString(3));
                tempnna.setApellidoM(temp.getString(4));
                tempnna.setSexo(temp.getString(5));
                tempnna.setFechaNacimiento(temp.getDate(6));
                tempnna.setEdadAnhos(temp.getShort(7));
                tempnna.setEdadMeses(temp.getShort(8));
                tempnna.setActaNacimiento(temp.getShort(9));
                tempnna.setCondicionSalud(temp.getString(10));
                tempnna.setDepartamentoNacimiento(temp.getString(11));
                tempnna.setProvinciaNacimiento(temp.getString(12));
                tempnna.setDistritoNacimiento(temp.getString(13));
                tempnna.setPaisNacimiento(temp.getString(14));
                tempnna.setLugarNac(temp.getString(15));
                tempnna.setFechaResolAbandono(temp.getDate(16));
                tempnna.setFechaResolConsentida(temp.getDate(17));
                tempnna.setClasificacion(temp.getString(18));
                tempnna.setIncesto(temp.getShort(19));
                tempnna.setMental(temp.getShort(20));
                tempnna.setEpilepsia(temp.getShort(21));
                tempnna.setAbuso(temp.getShort(22));
                tempnna.setSifilis(temp.getShort(23));
                tempnna.setSeguiMedico(temp.getShort(24));
                tempnna.setOperacion(temp.getShort(25));
                tempnna.setHiperactivo(temp.getShort(26));
                tempnna.setEspecial(temp.getShort(27));
                tempnna.setEnfermo(temp.getShort(28));
                tempnna.setMayor(temp.getShort(29));
                tempnna.setAdolescente(temp.getShort(30));
                tempnna.setHermano(temp.getShort(31));
                tempnna.setNn(temp.getShort(32));
                tempnna.setObservaciones(temp.getString(33));
                tempnna.setNResolAband(temp.getString(34));
                tempnna.setNResolCons(temp.getString(35));
                try {
                    expnna = getExpNna(temp.getLong(1));
                    if (expnna.getIdexpedienteNna() != 0) {
                        Set<ExpedienteNna> listexp = new HashSet<ExpedienteNna>();
                        listexp.add(expnna);
                        tempnna.setExpedienteNnas(listexp);
                    }
                } catch (Exception e) {

                }
                allNnaAux.add(tempnna);
            }
            statement.close();
            temp.close();

            //AQUI DESIGNACIONES Y ESTUDIO DE CASOS EN CASO SEA PRIORITARIO
            for (Nna auxnna : allNnaAux) {
                Set<Designacion> listDesig = new HashSet<Designacion>();
                String hql2 = "{call HN_GET_DESIGNACIONES(?,?)}";
                CallableStatement statement2 = connection.prepareCall(hql2);
                statement2.setLong(1, auxnna.getIdnna());
                statement2.registerOutParameter(2, OracleTypes.CURSOR);
                statement2.execute();

                ResultSet rs2 = (ResultSet) statement2.getObject(2);
                while (rs2.next()) {
                    desig = new Designacion();
                    desig.setIddesignacion(rs2.getLong(1));
                    desig.setNDesignacion(rs2.getString(5));
                    desig.setPrioridad(rs2.getLong(6));
                    desig.setFechaPropuesta(rs2.getDate(7));
                    desig.setFechaConsejo(rs2.getDate(8));
                    desig.setAceptacionConsejo(rs2.getShort(9));
                    desig.setTipoPropuesta(rs2.getString(10));
                    desig.setObs(rs2.getString(11));
                    listDesig.add(desig);
                }
                auxnna.setDesignacions(listDesig);
                allNna.add(auxnna);
                statement2.close();
                rs2.close();
            }

            for (Nna auxnna : allNna) {
                if (auxnna.getClasificacion().equals("prioritario")) {
                    Set<EstudioCaso> listEst = new HashSet<EstudioCaso>();
                    String hql3 = "{call HN_GET_ESTUDIOS_CASO(?,?)}";
                    CallableStatement statement3 = connection.prepareCall(hql3);
                    statement3.setLong(1, auxnna.getIdnna());
                    statement3.registerOutParameter(2, OracleTypes.CURSOR);
                    statement3.execute();

                    ResultSet rs3 = (ResultSet) statement3.getObject(2);
                    while (rs3.next()) {
                        est = new EstudioCaso();
                        est.setIdestudioCaso(rs3.getLong(1));
                        est.setOrden(rs3.getString(4));
                        est.setFechaEstudio(rs3.getDate(5));
                        est.setFechaSolAdop(rs3.getDate(6));
                        est.setResultado(rs3.getString(7));
                        est.setPrioridad(rs3.getLong(8));
                        est.setNSolicitud(rs3.getLong(9));
                        listEst.add(est);
                    }
                    auxnna.setEstudioCasos(listEst);
                    statement3.close();
                    rs3.close();
                }
                allNnaFinal.add(auxnna);
            }

            //METODO BUBBLESORT PARA ORDENAR POR CODIGO
            if (clasif.equals("prioritario")) {
                Nna auxnna2;
                int n = allNnaFinal.size();
                for (int i = 0; i < n - 1; i++) {
                    for (int j = i; j < n - 1; j++) {
                        if (allNnaFinal.get(i).getExpedienteNnas().isEmpty()) {
                            if (!allNnaFinal.get(j + 1).getExpedienteNnas().isEmpty()) {
                                auxnna2 = allNnaFinal.get(i);
                                allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                allNnaFinal.set(j + 1, auxnna2);
                            } else {
                                String apellidoPrev = "";
                                String apellidoNext = "";
                                try {
                                    apellidoPrev = allNnaFinal.get(i).getApellidoP();
                                    if (apellidoPrev == null) {
                                        apellidoPrev = "";
                                    }
                                } catch (Exception ex) {
                                    apellidoPrev = "";
                                }
                                try {
                                    apellidoNext = allNnaFinal.get(j + 1).getApellidoP();
                                    if (apellidoNext == null) {
                                        apellidoNext = "";
                                    }
                                } catch (Exception ex) {
                                    apellidoNext = "";
                                }

                                if (apellidoPrev.compareToIgnoreCase(apellidoNext) > 0) {
                                    auxnna2 = allNnaFinal.get(i);
                                    allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                    allNnaFinal.set(j + 1, auxnna2);
                                }
                            }
                        } else {
                            Set<ExpedienteNna> listExp1 = allNnaFinal.get(i).getExpedienteNnas();
                            Set<ExpedienteNna> listExp2 = allNnaFinal.get(j + 1).getExpedienteNnas();
                            if (!listExp2.isEmpty()) {
                                for (ExpedienteNna exp1 : listExp1) {
                                    for (ExpedienteNna exp2 : listExp2) {
                                        String codant = exp1.getCodigoReferencia();
                                        String codpost = exp2.getCodigoReferencia();
                                        if (codant == null) {
                                            codant = "";
                                        }
                                        if (codpost == null) {
                                            codpost = "";
                                        }
                                        if (codant.compareToIgnoreCase(codpost) > 0) {
                                            auxnna2 = allNnaFinal.get(i);
                                            allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                            allNnaFinal.set(j + 1, auxnna2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    };
    session.doWork(work);

    return allNnaFinal;
}

From source file:com.mimp.hibernate.HiberNna.java

public ArrayList<Nna> ListaNna(String clasificacion) {
    Session session = sessionFactory.getCurrentSession();
    final String clasif = clasificacion;
    final ArrayList<Nna> allNna = new ArrayList();
    final ArrayList<Nna> allNnaAux = new ArrayList();
    final ArrayList<Nna> allNnaFinal = new ArrayList();

    Work work = new Work() {
        @Override/*from w ww.  j av a  2s.co  m*/
        public void execute(Connection connection) throws SQLException {
            ExpedienteNna expnna;
            Nna tempnna;
            Designacion desig;

            EstudioCaso est;

            String hql = "{call HN_GET_NNA_CLAS(?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setString(1, clasif);
            statement.registerOutParameter(2, OracleTypes.CURSOR);
            statement.execute();

            temp = (ResultSet) statement.getObject(2);

            while (temp.next()) {
                tempnna = new Nna();
                tempnna.setIdnna(temp.getLong(1));
                tempnna.setNombre(temp.getString(2));
                tempnna.setApellidoP(temp.getString(3));
                tempnna.setApellidoM(temp.getString(4));
                tempnna.setSexo(temp.getString(5));
                tempnna.setFechaNacimiento(temp.getDate(6));
                tempnna.setEdadAnhos(temp.getShort(7));
                tempnna.setEdadMeses(temp.getShort(8));
                tempnna.setActaNacimiento(temp.getShort(9));
                tempnna.setCondicionSalud(temp.getString(10));
                tempnna.setDepartamentoNacimiento(temp.getString(11));
                tempnna.setProvinciaNacimiento(temp.getString(12));
                tempnna.setDistritoNacimiento(temp.getString(13));
                tempnna.setPaisNacimiento(temp.getString(14));
                tempnna.setLugarNac(temp.getString(15));
                tempnna.setFechaResolAbandono(temp.getDate(16));
                tempnna.setFechaResolConsentida(temp.getDate(17));
                tempnna.setClasificacion(temp.getString(18));
                tempnna.setIncesto(temp.getShort(19));
                tempnna.setMental(temp.getShort(20));
                tempnna.setEpilepsia(temp.getShort(21));
                tempnna.setAbuso(temp.getShort(22));
                tempnna.setSifilis(temp.getShort(23));
                tempnna.setSeguiMedico(temp.getShort(24));
                tempnna.setOperacion(temp.getShort(25));
                tempnna.setHiperactivo(temp.getShort(26));
                tempnna.setEspecial(temp.getShort(27));
                tempnna.setEnfermo(temp.getShort(28));
                tempnna.setMayor(temp.getShort(29));
                tempnna.setAdolescente(temp.getShort(30));
                tempnna.setHermano(temp.getShort(31));
                tempnna.setNn(temp.getShort(32));
                tempnna.setObservaciones(temp.getString(33));
                tempnna.setNResolAband(temp.getString(34));
                tempnna.setNResolCons(temp.getString(35));
                try {
                    expnna = getExpNna(temp.getLong(1));
                    if (expnna.getIdexpedienteNna() != 0) {
                        Set<ExpedienteNna> listexp = new HashSet<ExpedienteNna>();
                        listexp.add(expnna);
                        tempnna.setExpedienteNnas(listexp);
                    }
                } catch (Exception e) {

                }
                allNnaAux.add(tempnna);
            }
            statement.close();
            temp.close();

            //AQUI DESIGNACIONES Y ESTUDIO DE CASOS EN CASO SEA PRIORITARIO
            for (Nna auxnna : allNnaAux) {
                Set<Designacion> listDesig = new HashSet<Designacion>();
                String hql2 = "{call HN_GET_DESIGNACIONES(?,?)}";
                CallableStatement statement2 = connection.prepareCall(hql2);
                statement2.setLong(1, auxnna.getIdnna());
                statement2.registerOutParameter(2, OracleTypes.CURSOR);
                statement2.execute();

                ResultSet rs2 = (ResultSet) statement2.getObject(2);
                while (rs2.next()) {
                    desig = new Designacion();
                    desig.setIddesignacion(rs2.getLong(1));
                    desig.setNDesignacion(rs2.getString(5));
                    desig.setPrioridad(rs2.getLong(6));
                    desig.setFechaPropuesta(rs2.getDate(7));
                    desig.setFechaConsejo(rs2.getDate(8));
                    desig.setAceptacionConsejo(rs2.getShort(9));
                    desig.setTipoPropuesta(rs2.getString(10));
                    desig.setObs(rs2.getString(11));
                    listDesig.add(desig);
                }
                auxnna.setDesignacions(listDesig);
                allNna.add(auxnna);
                statement2.close();
                rs2.close();
            }

            for (Nna auxnna : allNna) {
                if (auxnna.getClasificacion().equals("prioritario")) {
                    Set<EstudioCaso> listEst = new HashSet<EstudioCaso>();
                    String hql3 = "{call HN_GET_ESTUDIOS_CASO(?,?)}";
                    CallableStatement statement3 = connection.prepareCall(hql3);
                    statement3.setLong(1, auxnna.getIdnna());
                    statement3.registerOutParameter(2, OracleTypes.CURSOR);
                    statement3.execute();

                    ResultSet rs3 = (ResultSet) statement3.getObject(2);
                    while (rs3.next()) {
                        est = new EstudioCaso();
                        est.setIdestudioCaso(rs3.getLong(1));
                        est.setOrden(rs3.getString(4));
                        est.setFechaEstudio(rs3.getDate(5));
                        est.setFechaSolAdop(rs3.getDate(6));
                        est.setResultado(rs3.getString(7));
                        est.setPrioridad(rs3.getLong(8));
                        est.setNSolicitud(rs3.getLong(9));
                        listEst.add(est);
                    }
                    auxnna.setEstudioCasos(listEst);
                    statement3.close();
                    rs3.close();
                }
                allNnaFinal.add(auxnna);
            }

            //METODO BUBBLESORT PARA ORDENAR POR CODIGO
            if (clasif.equals("prioritario")) {
                Nna auxnna2;
                int n = allNnaFinal.size();
                for (int i = 0; i < n - 1; i++) {
                    for (int j = i; j < n - 1; j++) {
                        if (allNnaFinal.get(i).getExpedienteNnas().isEmpty()) {
                            if (!allNnaFinal.get(j + 1).getExpedienteNnas().isEmpty()) {
                                auxnna2 = allNnaFinal.get(i);
                                allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                allNnaFinal.set(j + 1, auxnna2);
                            } else {
                                String apellidoPrev = "";
                                String apellidoNext = "";
                                try {
                                    apellidoPrev = allNnaFinal.get(i).getApellidoP();
                                    if (apellidoPrev == null) {
                                        apellidoPrev = "";
                                    }
                                } catch (Exception ex) {
                                    apellidoPrev = "";
                                }
                                try {
                                    apellidoNext = allNnaFinal.get(j + 1).getApellidoP();
                                    if (apellidoNext == null) {
                                        apellidoNext = "";
                                    }
                                } catch (Exception ex) {
                                    apellidoNext = "";
                                }
                                if (apellidoPrev.compareToIgnoreCase(apellidoNext) > 0) {
                                    auxnna2 = allNnaFinal.get(i);
                                    allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                    allNnaFinal.set(j + 1, auxnna2);
                                }
                            }
                        } else {
                            Set<ExpedienteNna> listExp1 = allNnaFinal.get(i).getExpedienteNnas();
                            Set<ExpedienteNna> listExp2 = allNnaFinal.get(j + 1).getExpedienteNnas();
                            if (!listExp2.isEmpty()) {
                                for (ExpedienteNna exp1 : listExp1) {
                                    for (ExpedienteNna exp2 : listExp2) {
                                        String codant = exp1.getCodigoReferencia();
                                        String codpost = exp2.getCodigoReferencia();
                                        if (codant == null) {
                                            codant = "";
                                        }
                                        if (codpost == null) {
                                            codpost = "";
                                        }
                                        if (codant.compareToIgnoreCase(codpost) > 0) {
                                            auxnna2 = allNnaFinal.get(i);
                                            allNnaFinal.set(i, allNnaFinal.get(j + 1));
                                            allNnaFinal.set(j + 1, auxnna2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    };
    session.doWork(work);

    return allNnaFinal;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleAuditActionTable.java

public CFSecurityAuditActionBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;/*from   ww  w .  ja v a  2s .  c om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_auditactionbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, AuditActionId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSysClusterTable.java

public CFSecuritySysClusterBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, int SingletonId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;//  w w  w.ja  v  a  2s .c  o m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_sysclusbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setInt(argIdx++, SingletonId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFSecuritySysClusterBuff buff = unpackSysClusterResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAuditActionTable.java

public CFAccAuditActionBuff readBuffByIdIdx(CFAccAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;//from   www . j a v a2  s .  c o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_auditactionbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, AuditActionId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleAuditActionTable.java

public CFAstAuditActionBuff readBuffByIdIdx(CFAstAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;//www  .  j a v  a  2 s  .c o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_auditactionbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, AuditActionId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}