use of com.nixmash.blog.jpa.dto.TagDTO in project nixmash-blog by mintster.
the class PostServiceImpl method saveNewTagsToDataBase.
@Transactional
private void saveNewTagsToDataBase(PostDTO postDTO) {
for (TagDTO tagDTO : postDTO.getTags()) {
Tag tag = tagRepository.findByTagValueIgnoreCase(tagDTO.getTagValue());
if (tag == null) {
tag = new Tag(tagDTO.getTagValue());
tagRepository.save(tag);
}
}
}
Aggregations