@Override public void update(Brand brand) throws DaoException { try { Brand res = entityManager.find(Brand.class, brand.getId()); res.setName(brand.getName()); } catch (HibernateException e) { throw new DaoException(e); } }
@Override public String create(Brand brand) throws DaoException { try { entityManager.persist(brand); } catch (HibernateException e) { throw new DaoException(e); } return brand.getId(); }