summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/nu/xss/jpa/dao/GenericJpaDao.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java b/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java
index cac96e6..9e2babb 100644
--- a/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java
+++ b/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java
@@ -6,6 +6,9 @@ import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Root;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,8 +54,11 @@ public abstract class GenericJpaDao<E, K> implements Dao<E, K>, Serializable {
}
public List<E> findAll() {
- // TODO Auto-generated method stub
- return null;
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<E> c = cb.createQuery(this.entity);
+ Root<E> root = c.from(this.entity);
+ c.select(root);
+ return entityManager.createQuery(c).getResultList();
}
}