List of usage examples for org.hibernate Criteria uniqueResult
public Object uniqueResult() throws HibernateException;
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countDB2() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2()"); final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.eq("vendor", "DB2")); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2() -> Found " + count + " DB2 Databases."); return count; }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countAllDataBases() { final Criteria criteria = session().createCriteria(BancoDados.class); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countAllDataBases() -> Found " + count + " Databases."); return count; }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countDataBasesOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDataBasesOK()"); try {/*from ww w .j a v a 2 s.co m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.eq("status", "OK")); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] Data Bases OK: " + count); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countDataBasesNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDataBasesNOK()"); try {/* w w w . j a v a2 s.co m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] Data Bases not NOK: " + count); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countMySQLOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countMySQLOK()"); try {//from ww w . j a va2 s .co m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "MYSQL"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countMySQLOK() -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countMySQLNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countMySQLNOK()"); try {/*from w w w. j ava 2s.co m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "MYSQL"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countMySQLNOK() -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countOracleOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countOracleOK()"); try {//from w ww.java 2 s . co m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "ORACLE"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countOracleOK() -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countOracleNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countOracleNOK()"); try {/*from w w w . j a va 2s . c o m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "ORACLE"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countOracleNOK() -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countPostgreOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreOK()"); try {// w w w . j av a 2 s.com final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add( Restrictions.and(Restrictions.eq("vendor", "POSTGRESQL"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreOK -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countPostgreNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreNOK"); try {/*from w w w .j ava2s. c o m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "POSTGRESQL"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreNOK() -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }