コード例 #1
0
  @Override
  public void addWordToUser(final User user, final Word word) {
    final UserEntity userEntity = getUserEntity(user.getEmail());
    final WordEntity wordEntity = dictionaryDaoHibernate.registerWord(word);

    sessionFactory.getCurrentSession().save(new UserWordEntity(userEntity, wordEntity));
  }
コード例 #2
0
 @Override
 public void removeWord(final User user, final Word word) {
   sessionFactory
       .getCurrentSession()
       .createQuery(
           "delete UserWordEntity where userEntity = :userEntity "
               + "and wordEntity = :wordEntity")
       .setParameter("userEntity", getUserEntity(user.getEmail()))
       .setParameter("wordEntity", dictionaryDaoHibernate.registerWord(word))
       .executeUpdate();
 }