JPA data access object - exception handling and rollback
问题 I'd like to know what the best way of exception handling in data access objects is, I'm interested in production quality code. As an example public UserDaoImpl implements UserDao{ @PersistenceContext private EntityManager em; void save(User user){ em.persist(user); } User getById(long id){ return em.find(User.class,id); } } Let's say that for example I have a RegisterService somewhere where at some point I'd like to save the user to the database. And that each User needs to have a unique