Example usage for java.sql CallableStatement setDate

List of usage examples for java.sql CallableStatement setDate

Introduction

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

Prototype

void setDate(String parameterName, java.sql.Date x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application.

Usage

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

public void updateExpNna(ExpedienteNna temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*from  www.  j  a  v a 2 s.c  o  m*/
    final ExpedienteNna expnna = temp;

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HN_UPDATE_EXP_NNA(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, expnna.getNna().getIdnna());
            statement.setLong(2, expnna.getUnidad().getIdunidad());
            statement.setString(3, expnna.getNumero());
            statement.setDate(4, (java.sql.Date) expnna.getFechaIngreso());
            statement.setString(5, expnna.getHt());
            statement.setString(6, expnna.getNExpTutelar());
            statement.setString(7, expnna.getProcTutelar());
            statement.setShort(8, expnna.getFichaIntegral());
            statement.setString(9, expnna.getComentarios());
            statement.setString(10, expnna.getRespLegalNombre());
            statement.setString(11, expnna.getRespLegalP());
            statement.setString(12, expnna.getRespLegalM());
            statement.setString(13, expnna.getRespPsicosocialNombre());
            statement.setString(14, expnna.getRespPiscosocialP());
            statement.setString(15, expnna.getRespPsicosocialM());
            statement.setString(16, expnna.getEstado());
            statement.setDate(17, (java.sql.Date) expnna.getFechaEstado());
            statement.setShort(18, expnna.getAdoptable());
            statement.setDate(19, (java.sql.Date) expnna.getFechaResolCons());
            statement.setShort(20, expnna.getNacional());
            statement.setString(21, expnna.getDiagnostico());
            statement.setString(22, expnna.getCodigoReferencia());
            statement.setString(23, expnna.getNActual());
            statement.setString(24, expnna.getApellidopActual());
            statement.setString(25, expnna.getApellidomActual());
            statement.setString(26, expnna.getObservaciones());
            statement.setDate(27, (java.sql.Date) expnna.getFechaInvTutelar());
            statement.setLong(28, expnna.getIdexpedienteNna());
            statement.setDate(29, (java.sql.Date) expnna.getFechaIngPrio());
            statement.setDate(30, (java.sql.Date) expnna.getFechaActualizacion());

            statement.execute();
            statement.close();
        }
    };
    session.doWork(work);
}

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

public void crearNna(Nna temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*from   w w w  .ja v a  2s  .  com*/
    final Nna nna = temp;

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HN_SAVE_NNA(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, nna.getJuzgado().getIdjuzgado());
            statement.setLong(2, nna.getCar().getIdcar());
            statement.setString(3, nna.getNombre());
            statement.setString(4, nna.getApellidoP());
            statement.setString(5, nna.getApellidoM());
            statement.setString(6, nna.getSexo());
            statement.setDate(7, (java.sql.Date) nna.getFechaNacimiento());
            statement.setShort(8, nna.getEdadAnhos());
            statement.setShort(9, nna.getEdadMeses());
            statement.setShort(10, nna.getActaNacimiento());
            statement.setString(11, nna.getCondicionSalud());
            statement.setString(12, nna.getDepartamentoNacimiento());
            statement.setString(13, nna.getProvinciaNacimiento());
            statement.setString(14, nna.getDistritoNacimiento());
            statement.setString(15, nna.getPaisNacimiento());
            statement.setString(16, nna.getLugarNac());
            statement.setDate(17, (java.sql.Date) nna.getFechaResolAbandono());
            statement.setDate(18, (java.sql.Date) nna.getFechaResolConsentida());
            statement.setString(19, nna.getClasificacion());
            statement.setShort(20, nna.getIncesto());
            statement.setShort(21, nna.getMental());
            statement.setShort(22, nna.getEpilepsia());
            statement.setShort(23, nna.getAbuso());
            statement.setShort(24, nna.getSifilis());
            statement.setShort(25, nna.getSeguiMedico());
            statement.setShort(26, nna.getOperacion());
            statement.setShort(27, nna.getHiperactivo());
            statement.setShort(28, nna.getEspecial());
            statement.setShort(29, nna.getEnfermo());
            statement.setShort(30, nna.getMayor());
            statement.setShort(31, nna.getAdolescente());
            statement.setShort(32, nna.getHermano());
            statement.setShort(33, nna.getNn());
            statement.setString(34, nna.getObservaciones());
            statement.setString(35, nna.getNResolAband());
            statement.setString(36, nna.getNResolCons());

            statement.execute();
            statement.close();
        }
    };
    session.doWork(work);
}

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

public void updateNna(Nna temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*  w w w . jav a 2s  .c o  m*/
    final Nna nna = temp;

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HN_UPDATE_NNA(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, nna.getJuzgado().getIdjuzgado());
            statement.setLong(2, nna.getCar().getIdcar());
            statement.setString(3, nna.getNombre());
            statement.setString(4, nna.getApellidoP());
            statement.setString(5, nna.getApellidoM());
            statement.setString(6, nna.getSexo());
            statement.setDate(7, (java.sql.Date) nna.getFechaNacimiento());
            statement.setShort(8, nna.getEdadAnhos());
            statement.setShort(9, nna.getEdadMeses());
            statement.setShort(10, nna.getActaNacimiento());
            statement.setString(11, nna.getCondicionSalud());
            statement.setString(12, nna.getDepartamentoNacimiento());
            statement.setString(13, nna.getProvinciaNacimiento());
            statement.setString(14, nna.getDistritoNacimiento());
            statement.setString(15, nna.getPaisNacimiento());
            statement.setString(16, nna.getLugarNac());
            statement.setDate(17, (java.sql.Date) nna.getFechaResolAbandono());
            statement.setDate(18, (java.sql.Date) nna.getFechaResolConsentida());
            statement.setString(19, nna.getClasificacion());
            statement.setShort(20, nna.getIncesto());
            statement.setShort(21, nna.getMental());
            statement.setShort(22, nna.getEpilepsia());
            statement.setShort(23, nna.getAbuso());
            statement.setShort(24, nna.getSifilis());
            statement.setShort(25, nna.getSeguiMedico());
            statement.setShort(26, nna.getOperacion());
            statement.setShort(27, nna.getHiperactivo());
            statement.setShort(28, nna.getEspecial());
            statement.setShort(29, nna.getEnfermo());
            statement.setShort(30, nna.getMayor());
            statement.setShort(31, nna.getAdolescente());
            statement.setShort(32, nna.getHermano());
            statement.setShort(33, nna.getNn());
            statement.setString(34, nna.getObservaciones());
            statement.setString(35, nna.getNResolAband());
            statement.setString(36, nna.getNResolCons());
            statement.setLong(37, nna.getIdnna());

            statement.execute();
            statement.close();
        }
    };
    session.doWork(work);
}

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

public void crearPostAdopcion(PostAdopcion temp) {

    Session session = sessionFactory.getCurrentSession();

    final Long idFam = temp.getFamilia().getIdfamilia();
    final Date fechaResol = temp.getFechaResolucion();
    final Long idNna = temp.getidNna();

    Work work = new Work() {
        @Override/*from  ww  w  . j ava 2 s  . c  om*/
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_SAVE_POST(?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idFam);
            statement.setDate(2, (java.sql.Date) fechaResol);
            statement.setLong(3, idNna);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public void updateEstudioCaso(EstudioCaso temp) {

    Session session = sessionFactory.getCurrentSession();

    final Long idEs = temp.getIdestudioCaso();
    final Date fechaEst = temp.getFechaEstudio();
    final Date fechaSol = temp.getFechaSolAdop();
    final String res = temp.getResultado();
    final Long nsol = temp.getNSolicitud();

    Work work = new Work() {
        @Override//from   www. ja  va 2 s .  c  o  m
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_UPDATE_ESTUDIO(?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idEs);
            statement.setDate(2, (java.sql.Date) fechaEst);
            statement.setDate(3, (java.sql.Date) fechaSol);
            statement.setString(4, res);
            statement.setLong(5, nsol);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public void crearRevision(Revision temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*from  w  w w .  j a  va 2 s  . c  o  m*/

    final Long idN = temp.getNna().getIdnna();
    final Long idExp = temp.getExpedienteFamilia().getIdexpedienteFamilia();
    final String num = temp.getNumero();
    final Date fechaRev = temp.getFechaRevision();
    final String coment = temp.getComentarios();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_CREAR_REVISION(?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idN);
            statement.setLong(2, idExp);
            statement.setString(3, num);
            statement.setDate(4, (java.sql.Date) fechaRev);
            statement.setString(5, coment);

            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public void updatePostAdopcion(PostAdopcion temp) {

    Session session = sessionFactory.getCurrentSession();

    final Long idpost = temp.getIdpostAdopcion();
    final Long idFam = temp.getFamilia().getIdfamilia();
    final Long numInfor = temp.getNumeroInformes();
    final Date fechaResol = temp.getFechaResolucion();
    final Long idNna = temp.getidNna();

    Work work = new Work() {
        @Override//w  w  w  . j a va 2 s .  com
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_UPDATE_POST_ADOPCION(?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idpost);
            statement.setLong(2, idFam);
            statement.setLong(3, numInfor);
            statement.setDate(4, (java.sql.Date) fechaResol);
            statement.setLong(5, idNna);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public void updateDesignacion(Designacion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();//from w w  w .  j  ava2s .  c  o m

    final Long idDe = temp.getIddesignacion();
    final Long idEx = temp.getExpedienteFamilia().getIdexpedienteFamilia();
    final Long idNna = temp.getNna().getIdnna();
    final Long idPer = temp.getPersonal().getIdpersonal();
    final String nDesig = temp.getNDesignacion();
    final Long prio = temp.getPrioridad();
    final Date fechaPro = temp.getFechaPropuesta();
    final Date fechaCon = temp.getFechaConsejo();
    final short acepCon = temp.getAceptacionConsejo();
    final String tipo = temp.getTipoPropuesta();
    final String obs = temp.getObs();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_UPDATE_DESIG(?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idDe);
            statement.setString(2, nDesig);
            statement.setLong(3, prio);
            statement.setDate(4, (java.sql.Date) fechaPro);
            statement.setDate(5, (java.sql.Date) fechaCon);
            statement.setShort(6, acepCon);
            statement.setString(7, tipo);
            statement.setString(8, obs);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public void crearResolEvaluacion(Resolucion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();//from w ww.  ja  v  a 2 s .  c  o  m

    final Long idEv = temp.getEvaluacion().getIdevaluacion();
    final String tipoResol = temp.getTipo();
    final String numResol = temp.getNumero();
    final Date fechaRes = temp.getFechaResol();
    final Date fechaNot = temp.getFechaNotificacion();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_CREAR_RESOL(?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idEv);
            statement.setString(2, tipoResol);
            statement.setString(3, numResol);
            statement.setDate(4, (java.sql.Date) fechaRes);
            statement.setDate(5, (java.sql.Date) fechaNot);

            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public void crearEvaluacion(Evaluacion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*from   w  w  w  .j a v a 2 s  .c  o m*/

    final Long idExp = temp.getExpedienteFamilia().getIdexpedienteFamilia();
    final Long idPer = temp.getPersonal().getIdpersonal();
    final String tipoEval = temp.getTipo();
    final Date fechaAsig = temp.getFechaAsignacion();
    final String result = temp.getResultado();
    final Date fechaResul = temp.getFechaResultado();
    final String obs = temp.getObservacion();
    final String sust = temp.getSustento();
    final String ndesig = temp.getNDesignacion();
    final String numEval = temp.getNumEval();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_CREAR_EVAL(?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idExp);
            statement.setLong(2, idPer);
            statement.setString(3, tipoEval);
            statement.setDate(4, (java.sql.Date) fechaAsig);
            statement.setString(5, result);
            statement.setDate(6, (java.sql.Date) fechaResul);
            statement.setString(7, obs);
            statement.setString(8, sust);
            statement.setString(9, ndesig);
            statement.setString(10, numEval);

            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}