List of usage examples for org.hibernate StatelessSession createCriteria
@Deprecated Criteria createCriteria(Class persistentClass);
From source file:vault.queryrouter.models.dao.UserDAO.java
License:Apache License
public static String getPassword(StatelessSession session, String userName, int tenantMppdbId) { Iterator users;//ww w. j av a2 s . c o m String password = null; try { Criteria criteria = session.createCriteria(User.class); criteria.add(Expression.eq("userName", userName)); criteria.add(Expression.eq("tenantMppdbId", tenantMppdbId)); users = criteria.list().iterator(); while (users.hasNext()) { User user = (User) users.next(); password = user.getPassword(); } } catch (Exception e) { logger.error("Fail to get password", e); throw e; } return password; }