What does EntityManager.getSingleResult()
return for a COUNT query?
So.. what is the precise runtime type of foo?
Object foo = em.createQuer
NB : there's a difference between JQPL and Native query
Query query = em.createQuery("SELECT COUNT(p) FROM PersonEntity p " );
query.getSingleResult().getClass().getCanonicalName()
--> java.lang.Long
Query query = em.createNativeQuery("SELECT COUNT(*) FROM PERSON " );
query.getSingleResult().getClass().getCanonicalName()
--> java.math.BigInteger