@Override @Transactional(readOnly = true) public Language getLanguageByCode(Store store, String languageCode) { Language language = languageDataAccess.getLanguageByCode(store.getId(), languageCode); if (language == null) { Language lang = getNewLanguage(); lang.setCode(languageCode); lang.getStores().add(store); save(lang); return lang; } return language; }
@Override @Transactional public void save(Language language) { if (language.getId() == null) { languageDataAccess.persist(language); } else { languageDataAccess.merge(language); } }