Returning result of count native query using EntityManager in Java?

I have the following SQL Query : SELECT COUNT(*) FROM DOG where ID = ‘SampleId’; I am trying to write this in java : public int returnCountOfDogTable(String id){ String sql= “SELECT …