We will need to expose the following APIs to interact with the countrylanguage table:
Get list of languages for a given country code
Add a new language for a country by checking that the language doesn't already exist
Delete a language for a country
For the sake of keeping it short, we will show the method implementations covering these three scenarios. The complete code can be found in the com.nilangpatel.worldgdp.dao.CountryLanguageDAO class available in the code downloaded for this book. The following is the code for these method implementations:
public List<CountryLanguage> getLanguages(String countryCode, Integer pageNo){ Map<String, Object> params = new HashMap<String, Object>(); params.put("code", countryCode);