List of usage examples for org.hibernate Criteria setProjection
public Criteria setProjection(Projection projection);
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countServerWithLog() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countServerWithLog()"); try {/* w w w. j a v a2s .c om*/ final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.not(Restrictions.eq("logDir", ""))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countServerWithLog -> found: " + count); return count; } catch (Exception e) { log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public String getPass(String username) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getPass(String user)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("password")); criteria.setProjection(proList); return criteria.uniqueResult().toString(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public int searchUser(String username) { log.fine("[ " + userInfo.getLoggedUsername() + " ] searchUser(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); return count; }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public int searchUserNotLogged(String username) { log.fine("[ System ] searchUser(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); return count; }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public String getMail(String username) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getMail(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("mail")); criteria.setProjection(proList); return criteria.uniqueResult().toString(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public String getMailNotLogged(String username) { log.fine("[ System ] getMail(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("mail")); criteria.setProjection(proList); return criteria.uniqueResult().toString(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public int searchUserChangePass(String username) { log.fine(// w ww .ja v a 2 s .c o m "[ " + userInfo.getLoggedUsername() + " ] searchUserChangePass(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(PassExpire.class); criteria.add(Restrictions.eq("username", username)); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); return count; }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public int searchUserChangePassNotLogged(String username) { log.fine("[ System ] searchUserChangePass(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(PassExpire.class); criteria.add(Restrictions.eq("username", username)); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); return count; }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public String getRole(String user) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getUniqUser(String user)[" + user + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", user)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("authority")); criteria.setProjection(proList); return criteria.uniqueResult().toString(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public boolean getFirstLogin(String username) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getFirstLogin(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("firstLogin")); criteria.setProjection(proList); return (Boolean) criteria.uniqueResult(); }