List of usage examples for org.hibernate.criterion Projections rowCount
public static Projection rowCount()
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countPostgreOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreOK()"); try {//from w ww . ja v a 2 s.c o m 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 www. j ava2 s . 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; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countSqlServerOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerOK()"); try {/*ww w.j a v a 2s . c om*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "SQLSERVER"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerOK -> " + 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 countSqlServerNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerNOK"); try {/*from w ww.j a va 2 s .co m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "SQLSERVER"), 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() + " ] countSqlServerNOK() -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countDB2OK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2OK()"); try {/*from www . ja v a 2 s.c o m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "DB2"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2OK -> " + 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 countDB2NOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2NOK"); try {//from w ww . j a v a 2 s . c o m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "DB2"), 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() + " ] countDB2NOK() -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countWindows() { log.info("[ " + userInfo.getLoggedUsername() + " ] countWindows()"); final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.eq("SO", "WINDOWS")); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countWindows() -> Found " + count + " servers."); return count; }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countUnix() { log.info("[ " + userInfo.getLoggedUsername() + " ] countUnix()"); final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.eq("SO", "UNIX")); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countUnix() -> Found " + count + " servers."); return count; }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countAllServers() { log.info("[ " + userInfo.getLoggedUsername() + " ] countAllServers()"); final Criteria criteria = session().createCriteria(Servidores.class); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countAllServers() -> Found " + count + " servers."); return count; }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countServersOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countServersOK()"); try {/*w ww. j a v a2 s . co m*/ final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.eq("status", "OK")); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); return count; } catch (Exception e) { log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }