Using Java generics for JPA findAll() query with WHERE clause

前端 未结 4 1256
庸人自扰
庸人自扰 2020-12-14 02:50

So, After a 10+ year break I\'m coming back to Java and trying out stuff with JPA and Java generics. I\'ve created a generics based findAll(other) JPA query tha

4条回答
  •  囚心锁ツ
    2020-12-14 03:34

    you can also use a namedQuery named findAll for all your entities and call it in your generic FindAll with

    entityManager.createNamedQuery(persistentClass.getSimpleName()+"findAll").getResultList();
    

提交回复
热议问题