Example usage for org.hibernate.procedure ProcedureCall getOutputs

List of usage examples for org.hibernate.procedure ProcedureCall getOutputs

Introduction

In this page you can find the example usage for org.hibernate.procedure ProcedureCall getOutputs.

Prototype

ProcedureOutputs getOutputs();

Source Link

Document

Retrieves access to outputs of this procedure call.

Usage

From source file:com.football.site.db.DbHelper.java

public static boolean DeleteLeagueFixtures(int leagueId) {
    boolean retVal = false;
    Transaction tran = null;//  w ww .  j a va2  s. co m
    try {
        Session s = HibernateUtil.currentSession();
        tran = s.beginTransaction();
        ProcedureCall pc = s.createStoredProcedureCall("delete_league_fixtures");
        pc.registerParameter("p_league_id", Integer.class, ParameterMode.IN).bindValue(leagueId);
        ProcedureOutputs po = pc.getOutputs();
        tran.commit();
        retVal = true;
    } catch (Exception e) {
        if (tran != null) {
            tran.rollback();
        }
        HelperUtil.AddErrorLog(logger, e);
    } finally {
        HibernateUtil.closeSession();
    }
    return retVal;
}

From source file:com.football.site.db.DbHelper.java

public static boolean DeleteLeagueTables(int leagueId) {
    boolean retVal = false;
    Transaction tran = null;//  w w  w  .j  ava 2 s . c  o  m
    try {
        Session s = HibernateUtil.currentSession();
        tran = s.beginTransaction();
        ProcedureCall pc = s.createStoredProcedureCall("delete_league_table");
        pc.registerParameter("p_league_id", Integer.class, ParameterMode.IN).bindValue(leagueId);
        ProcedureOutputs po = pc.getOutputs();
        tran.commit();
        retVal = true;
    } catch (Exception e) {
        if (tran != null) {
            tran.rollback();
        }
        HelperUtil.AddErrorLog(logger, e);
    } finally {
        HibernateUtil.closeSession();
    }
    return retVal;
}

From source file:com.football.site.db.DbHelper.java

public static boolean DeleteLeagueTeams(Integer leagueId) {
    boolean retVal = false;
    Transaction tran = null;//from www . j  a v a2s .c om
    try {
        Session s = HibernateUtil.currentSession();
        tran = s.beginTransaction();
        ProcedureCall pc = s.createStoredProcedureCall("delete_league_teams");
        pc.registerParameter("p_league_id", Integer.class, ParameterMode.IN).bindValue(leagueId);
        ProcedureOutputs po = pc.getOutputs();
        tran.commit();
        retVal = true;
    } catch (Exception e) {
        if (tran != null) {
            tran.rollback();
        }
        HelperUtil.AddErrorLog(logger, e);
    } finally {
        HibernateUtil.closeSession();
    }
    return retVal;
}

From source file:com.football.site.db.DbHelper.java

public static void InsertLeagueTeamsInsertInfo(Integer recordId, Integer year) {
    Transaction tran = null;//  w  w w  .j  av  a  2  s .c o m
    try {
        Session s = HibernateUtil.currentSession();
        tran = s.beginTransaction();
        ProcedureCall pc = s.createStoredProcedureCall("delete_league_teams");
        pc.registerParameter("p_league_id", Integer.class, ParameterMode.IN).bindValue(recordId);
        pc.registerParameter("p_year", Integer.class, ParameterMode.IN).bindValue(year);
        ProcedureOutputs po = pc.getOutputs();
        tran.commit();
    } catch (Exception e) {
        if (tran != null) {
            tran.rollback();
        }
        HelperUtil.AddErrorLog(logger, e);
    } finally {
        HibernateUtil.closeSession();
    }
}

From source file:com.lzw.work.cms.manager.PreCarRegisterManager.java

public void getSeq() {
    final String sql = "EXEC Sequences  'ycscgs',''";
    Session session = null;/*from   w  w  w .  j av a 2 s.  c  om*/
    String code = "";
    try {
        session = this.getHibernateTemplate().getSessionFactory().openSession();
        ProcedureCall pc = session.createStoredProcedureCall("Sequences");
        pc.registerParameter("Table_Name", String.class, ParameterMode.IN).bindValue("ycscgs");
        pc.registerParameter("Seq_Type", String.class, ParameterMode.IN).bindValue("");
        pc.registerParameter("MaxId", String.class, ParameterMode.OUT);

        //         System.out.println(pc.getOutputs().getCurrent());
        code = (String) pc.getOutputs().getOutputParameterValue("MaxId");
        System.out.println(code);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (session != null) {
            session.clear();
            session.close();
        }
    }

    //      List<Object> list = this.getBaseList(sql, null, null);
    //      if(list==null||list.size()==0){
    //         return;
    //      }
    //      String code =(String) ((Map)list.get(0)).get("MaxDicId");
    code = code.trim();
    String prm = "??|";
    String path = System.getProperty("temp2code");
    create2Code(path, prm + code, code);
    Map map = new HashMap();
    map.put("data", code);
    map.put("state", "200");
    JSONObject jo = JSONObject.fromObject(map);
    pw.print(jo);
}