@Test public void updateTest() { int size = applicationDAO.getAll().size(); Application application = new Application(); application.setName("name"); boolean saved = applicationDAO.save(application); assertTrue(saved); Application applicationFromDatabase = applicationDAO.getAll().get(size); int id = applicationFromDatabase.getId(); assertEquals("name", applicationFromDatabase.getName()); applicationFromDatabase.setName("name2"); boolean updated = applicationDAO.update(applicationFromDatabase); assertTrue(updated); applicationFromDatabase = applicationDAO.getById(id); assertEquals("name2", applicationFromDatabase.getName()); }
@Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Application application) { entityManager.merge(application); entityManager.flush(); return true; }
ApplicationDAOJpa implements ApplicationDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Application application) { entityManager.merge(application); entityManager.flush(); return true; } }
ApplicationDAOJpa implements ApplicationDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Application application) { entityManager.merge(application); entityManager.flush(); return true; }  }
ApplicationDAOJpa implements ApplicationDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Application application) { entityManager.merge(application); entityManager.flush(); return true; }  @PersistenceContext (unitName = "applicationManagerDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Application getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Application getByIdWithoutDeployments(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Application> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Application> getAllWithOutDeployments(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Application application); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Application application); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Application application); @Override Application getByName(String name); @Override Application getByNameWithoutDeployments(String name); }
ApplicationDAOJpa implements ApplicationDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Application application) { entityManager.merge(application); entityManager.flush(); return true; }  @PersistenceContext (unitName = "applicationManagerDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Application getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Application getByIdWithoutDeployments(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Application> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Application> getAllWithOutDeployments(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Application application); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Application application); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Application application); @Override Application getByName(String name); @Override Application getByNameWithoutDeployments(String name);  }