summaryrefslogtreecommitdiffstats
path: root/src/main/java/nu
diff options
context:
space:
mode:
authorJohann Latocha2012-07-05 13:39:39 +0200
committerJohann Latocha2012-07-05 13:39:39 +0200
commit5e2029946f03a94e3a2d3730f141a2328cea0979 (patch)
tree65577c3a4322c0df95dd7ab33de0b77012396249 /src/main/java/nu
parentadd merge (diff)
parentadd findall implementation to generic dao (diff)
downloadxss-jpa-5e2029946f03a94e3a2d3730f141a2328cea0979.tar.gz
xss-jpa-5e2029946f03a94e3a2d3730f141a2328cea0979.tar.xz
xss-jpa-5e2029946f03a94e3a2d3730f141a2328cea0979.zip
Merge branch 'master' of xss.nu:xss-jpa
Diffstat (limited to 'src/main/java/nu')
-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();
}
}