Rolling back a transaction in a TransactionManagementType.BEAN
First of all, there's a difference with a TransactionManagementType.BEAN EJB. When an EJB is marked with the @TransactionManagement(TransactionManagementType.BEAN) annotation, transaction management is performed by calling the methods in the UserTransaction class.
For every method in which you need a transaction, you have to control the UserTransaction by yourself.
Rolling back a transaction in a TransactionManagementType.CONTAINER
The transaction will be automatically started at the start of the method and it will be committed at the end of the method.
The moment when context.setRollbackOnly() is invoked, the transaction will just be marked as rollback only and nothing will be persisted when the method ends and returns.