Im trying to use the @ApplicationException annotation in the Seam JPA sample in Tomcat 6.
But it seems does not work. When I insert the @ApplicationException in my exception class, if that exception happens, no rollback is activated... I tried to use the
"
rollback=true
property but in this case the entity is not persisted anymore... Is this problem a bug or is my mistake? Could you help me? here is the source code.
import org.jboss.seam.annotations.ApplicationException;
@ApplicationException
public class DAOException extends BasicException {
/**
*
*/
private static final long serialVersionUID = 1L;
public DAOException() {
}
public DAOException(Exception e) {
super(e);
}
public DAOException(String msg) {
super(msg);
}
}
import org.jboss.seam.annotations.ApplicationException;
@ApplicationException
public class BusinessException extends BasicException {
/**
*
*/
private static final long serialVersionUID = 1L;
public BusinessException() {
}
public BusinessException(Exception e) {
super(e);
}
public BusinessException(String msg) {
super(msg);
}
}
@Transactional
public void register(User user) throws BusinessException {
try {
userDAO.persist(user);
// Here I forced an exception, but no rollbacks happens
throw new BusinessException("Illegal name.");
} catch (DAOException e) {
throw new BusinessException(e);
}
}Hi, I'm not sure that I understand your question.
I tried setting rollback=true, but in this case the entity is not persisted
If the transaction is rolled back it is normal that the entity is not persisted, right?