Hello,
one short question regarding generic EJB3 DAO pattern.
Let's say on certain entity I want to have create method (makePersistent) to be run in the new transaction. This way outer transaction can handle creation exception. In such cases I would use:
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
As I need a method for above annotation, I override makePersistent in implementing session bean:
Code:
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
public User makePersistent(User entity) {
return super.makePersistent(entity);
}
this has no effect and the call is not executed in a new transaction.
If I define new method on the business interface (UserDAO):
public User makePersistent(User user);
the call is executed within a new transaction. Adding such method to DAO interface for particula entity doesn't make sence as there is "the same" one in the GenericDAO.
So the short question is: how to set transactional attributes on the methods defined in GenericDAO and implemented by GenericEjb3DAO, but only for some entities?
Thanks