@Transactional public void updateComment(Comment myComment) { Comment itemFromDbs = this.getCommentbyId(myComment.getId()); if (itemFromDbs != null) { itemFromDbs.setContent(myComment.getContent()); itemFromDbs.setArticleId(myComment.getArticleId()); entityManager.persist(itemFromDbs); } }