use of fi.otavanopisto.muikku.plugins.internalauth.model.InternalAuth in project muikku by otavanopisto.
the class InternalAuthDAO method create.
public InternalAuth create(Long userEntityId, String password) {
InternalAuth internalAuth = new InternalAuth();
internalAuth.setPassword(password);
internalAuth.setUserEntityId(userEntityId);
return persist(internalAuth);
}
use of fi.otavanopisto.muikku.plugins.internalauth.model.InternalAuth in project muikku by otavanopisto.
the class InternalAuthDAO method findByUserIdAndPassword.
public InternalAuth findByUserIdAndPassword(Long userEntityId, String password) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<InternalAuth> criteria = criteriaBuilder.createQuery(InternalAuth.class);
Root<InternalAuth> root = criteria.from(InternalAuth.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(InternalAuth_.userEntityId), userEntityId), criteriaBuilder.equal(root.get(InternalAuth_.password), password)));
return getSingleResult(entityManager.createQuery(criteria));
}
Aggregations