@Test @DataSet public void bookIsRemoved() throws PersistenceException { Book book = new Book("Spring in Action"); book.setId(1L); dao.removeBook(book); assertEquals(0, getNumberOfRecords("book")); }
@Override public void removeBook(Book book) { sessionFactory.getCurrentSession() .createQuery("delete from Book where id = :id") .setLong("id", book.getId()).executeUpdate(); }
HibernateBookDao implements BookDao { @Override public void removeBook(Book book) { sessionFactory.getCurrentSession() .createQuery("delete from Book where id = :id") .setLong("id", book.getId()).executeUpdate(); } }
HibernateBookDao implements BookDao { @Override public void removeBook(Book book) { sessionFactory.getCurrentSession() .createQuery("delete from Book where id = :id") .setLong("id", book.getId()).executeUpdate(); } HibernateBookDao(SessionFactory sessionFactory); }
HibernateBookDao implements BookDao { @Override public void removeBook(Book book) { sessionFactory.getCurrentSession() .createQuery("delete from Book where id = :id") .setLong("id", book.getId()).executeUpdate(); } HibernateBookDao(SessionFactory sessionFactory); @Override Book addBook(Book book); @Override void removeBook(Book book); }
HibernateBookDao implements BookDao { @Override public void removeBook(Book book) { sessionFactory.getCurrentSession() .createQuery("delete from Book where id = :id") .setLong("id", book.getId()).executeUpdate(); } HibernateBookDao(SessionFactory sessionFactory); @Override Book addBook(Book book); @Override void removeBook(Book book);  }