use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageSignature in project muikku by otavanopisto.
the class CommunicatorMessageSignatureDAO method create.
public CommunicatorMessageSignature create(String name, String content, UserEntity user) {
CommunicatorMessageSignature sig = new CommunicatorMessageSignature();
sig.setName(name);
sig.setSignature(content);
sig.setUser(user.getId());
getEntityManager().persist(sig);
return sig;
}
use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageSignature in project muikku by otavanopisto.
the class CommunicatorMessageSignatureDAO method listByUser.
public List<CommunicatorMessageSignature> listByUser(UserEntity user) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<CommunicatorMessageSignature> criteria = criteriaBuilder.createQuery(CommunicatorMessageSignature.class);
Root<CommunicatorMessageSignature> root = criteria.from(CommunicatorMessageSignature.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(CommunicatorMessageSignature_.user), user.getId()));
return entityManager.createQuery(criteria).getResultList();
}
Aggregations