@Test public void update() { int size = providerDAO.getAll().size(); Provider provider = new Provider(); provider.setName("name"); provider.setVmmUrl("http: provider.setSlamUrl("http2..."); boolean saved = providerDAO.save(provider); assertTrue(saved); Provider providerFromDatabase = providerDAO.getAll().get(size); int id = providerFromDatabase.getId(); assertEquals("name", providerFromDatabase.getName()); assertEquals("http: providerFromDatabase.setName("name2"); providerFromDatabase.setVmmUrl("http: boolean updated = providerDAO.update(providerFromDatabase); assertTrue(updated); providerFromDatabase = providerDAO.getById(id); assertEquals("name2", providerFromDatabase.getName()); assertEquals("http: }
@Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Provider provider) { entityManager.merge(provider); entityManager.flush(); return true; }
ProviderDAOJpa implements ProviderDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Provider provider) { entityManager.merge(provider); entityManager.flush(); return true; } }
ProviderDAOJpa implements ProviderDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Provider provider) { entityManager.merge(provider); entityManager.flush(); return true; }  }
ProviderDAOJpa implements ProviderDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Provider provider) { entityManager.merge(provider); entityManager.flush(); return true; }  @PersistenceContext (unitName = "providerRegistryDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Provider getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Provider> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Provider rpovider); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Provider provider); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Provider provider); }
ProviderDAOJpa implements ProviderDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Provider provider) { entityManager.merge(provider); entityManager.flush(); return true; }  @PersistenceContext (unitName = "providerRegistryDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Provider getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Provider> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Provider rpovider); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Provider provider); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Provider provider);  }