Quantcast
Channel: SCN : Discussion List - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 3131

Problem with select count in EclipseLink + JPA + Hana DB

$
0
0

We create a jpa 2.0 criteria  in order to count the number of register that matches a where claupsule:

 

CriteriaBuilder cb = this.entityManager.getCriteriaBuilder();

CriteriaQuery<Long> countCriteria = cb.createQuery(Long.class);

countCriteria.select(cb.count(countCriteria.from(this.clazz)));

if(criteria.getRestriction()!=null) {

     countCriteria.where(criteria.getRestriction());

}

int total = this.entityManager.createQuery(countCriteria).getSingleResult().intValue();

 

In this case, thre is only one restriction (instalacion_Ins_Identificador = 1), but the query generated is:

 

SELECT COUNT(t0.instalacion_Ins_Identificador) FROM USUARIOS t0, USUARIOS t1 WHERE ((t1.instalacion_Ins_Identificador = 1) = 1)")

 

and this doen't work.


Viewing all articles
Browse latest Browse all 3131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>