Exemplo n.º 1
0
 public List<String> getModuleNames() {
   Query query =
       HibernateUtilHis.getSession().createQuery("select distinct m.moduleName from Module m");
   List<String> list = query.list();
   if (list.size() < 1) {
     return new ArrayList<String>();
   } else {
     return (List<String>) list;
   }
 }
Exemplo n.º 2
0
  /**
   * This saves an MeasureLog
   *
   * @param measureLog MeasureLog entry to save
   */
  public void saveMeasureLog(MeasureLog measureLog, TxtLog txtLog, List<Module> modules) {
    try {
      // save measureLog
      HibernateUtilHis.getSession().save(measureLog);

      // save txtLogs
      if (measureLog.getTxtStatus() == 1 || measureLog.getTxtStatus() == 2) {
        HibernateUtilHis.getSession().save(txtLog);
      }

      // save modules
      if (modules.size() > 0) {
        for (Module module : modules) {
          HibernateUtilHis.getSession().save(module);
        }
      }
    } catch (Exception e) {
      HibernateUtilHis.rollbackTransaction();
      throw new RuntimeException(e);
    }
  }
Exemplo n.º 3
0
 public List<String> getModuleNamesByMeasureLog(MeasureLog measureLog) {
   Query query =
       HibernateUtilHis.getSession()
           .createQuery(
               "select distinct m.moduleName from Module m where m.measureLog = :measureLog");
   query.setEntity("measureLog", measureLog);
   List<String> list = query.list();
   if (list.size() < 1) {
     return new ArrayList<String>();
   } else {
     return (List<String>) list;
   }
 }
Exemplo n.º 4
0
 public MeasureDao() {
   HibernateUtilHis.beginTransaction();
 }