Since you're using Spring Boot, you can use Spring Data to create queries in your repository:
@Repository public interface CountryRepository extends JpaRepository<Country, Long> { }
Not a 100% on syntax, but should be something similar. Now you can autowire this class:
@Autowired public CountryRepository countryRepo;
And all basic methods are already available to you like:
countryRepo.findOne(id); countryRepo.find();
If you want to make more advanced queries, you can use Spring Data e.g.:
@Repository public interface CountryRepository extends JpaRepository<Country, Long> { public Country findByNameAndContinent(String name, String continent); }
This is just an example (a stupid one) of course and assumes your Country class has the field names 'name' and 'continent' and both are strings. More is available here: http://docs.spring.io/spring-data/jpa/docs/current/reference/html/ Section 5.3 more specifically.
PS: Make sure your Country class has the @Entity annotation
@PersistenceContext private EntityManager em;.