### Question:
HibernateRatingDAO extends HibernatePersistentObjectDAO<Rating> implements RatingDAO { @Override public boolean store(Rating rating, DocumentHistory transaction) throws PersistenceException { boolean result = super.store(rating); if (!result) return false; try { if (transaction != null) { transaction.setEvent(DocumentEvent.RATING_NEW.toString()); transaction.setComment("rating: " + rating.getVote()); DocumentDAO documentDao = (DocumentDAO) Context.get().getBean(DocumentDAO.class); documentDao.saveDocumentHistory(documentDao.findById(rating.getDocId()), transaction); } } catch (Throwable e) { if (transaction != null && StringUtils.isNotEmpty(transaction.getSessionId())) { Session session = SessionManager.get().get(transaction.getSessionId()); session.logError(e.getMessage()); } log.error(e.getMessage(), e); result = false; } return result; } HibernateRatingDAO(); @Override boolean store(Rating rating, DocumentHistory transaction); @Override Rating findVotesByDocId(long docId); @Override Rating findByDocIdAndUserId(long docId, long userId); @Override List<Rating> findByDocId(long docId); @Override boolean delete(long id, int code);  }### Answer:
@Test public void testStore() throws PersistenceException { Rating rat1 = dao.findById(1); dao.initialize(rat1); rat1.setVote(4); rat1.setUserId(3); dao.store(rat1); Assert.assertNotNull(rat1); Rating rat2 = dao.findById(2); dao.initialize(rat2); rat2.setVote(2); rat2.setDocId(4); dao.store(rat2); Assert.assertNotNull(rat2); rat1 = dao.findById(1); Assert.assertEquals(4, rat1.getVote()); Assert.assertEquals(3, rat1.getUserId()); rat2 = dao.findById(2); Assert.assertEquals(2, rat2.getVote()); Assert.assertEquals(4, rat2.getDocId()); }