Code example for BigInteger

Methods: intValue

0
 
        List<Object[]> resultList = query.getResultList();
        Object o = resultList.get(0);
        BigInteger number = (BigInteger) o;
 
        return number.intValue() == 0;
    } 
 
    @Override 
    public boolean chekEmailAvailability(String email) {
        Query query = em.createNativeQuery("SELECT count(*) FROM users where email = ?1");
        query.setParameter(1, email);
 
        List<Object[]> resultList = query.getResultList();
        Object o = resultList.get(0);
        BigInteger number = (BigInteger) o;
 
        return number.intValue() == 0;
    } 
}