コード例 #1
0
 @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);
   }
 }
コード例 #2
0
 @Override
 public String create(Brand brand) throws DaoException {
   try {
     entityManager.persist(brand);
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
   return brand.getId();
 }