Mas entao, se eu nao colocar nem na classe nem no metodo @Transactional(REQUIRED), será criada a transação? Repetindo, se eu NAO incluir essa anotação…
The container invokes an enterprise bean method whose transaction attribute is set to the NOT_SUPPORTED value with an unspecified transaction context.
If a client calls with a transaction context, the container SUSPENDS the association of the transaction context with the current thread before invoking the enterprise bean’s business method. The container RESUMES the suspended association when the business method has completed. The suspended transaction context of the client is not passed to the resource managers or other enterprise bean objects that are invoked from the business method.
If the business method invokes other enterprise beans, the container passes no transaction context with the invocation.
SUPPORTS
The container invokes an enterprise bean method whose transaction attribute is set to SUPPORTS as follows:
If the client calls WITH a transaction context, the container performs the same steps as described in the REQUIRED case.
If the client calls WITHOUT a transaction context, the container performs the same steps as described in the NOT_SUPPORTED case.
The SUPPORTS transaction attribute must be used with caution. This is because of the different transactional semantics provided by the two possible modes of execution. Only the enterprise beans that will execute correctly in both modes should use the SUPPORTS transaction attribute.
The container invokes an enterprise bean method whose transaction attribute is set to the NOT_SUPPORTED value with an unspecified transaction context.
If a client calls with a transaction context, the container SUSPENDS the association of the transaction context with the current thread before invoking the enterprise bean’s business method. The container RESUMES the suspended association when the business method has completed. The suspended transaction context of the client is not passed to the resource managers or other enterprise bean objects that are invoked from the business method.
If the business method invokes other enterprise beans, the container passes no transaction context with the invocation.
SUPPORTS
The container invokes an enterprise bean method whose transaction attribute is set to SUPPORTS as follows:
If the client calls WITH a transaction context, the container performs the same steps as described in the REQUIRED case.
If the client calls WITHOUT a transaction context, the container performs the same steps as described in the NOT_SUPPORTED case.
The SUPPORTS transaction attribute must be used with caution. This is because of the different transactional semantics provided by the two possible modes of execution. Only the enterprise beans that will execute correctly in both modes should use the SUPPORTS transaction attribute.
Beleza cara, valeu…na verdade eu conhecia esses comportamentos, mas fiquei com duvida sobre o que ocorreria quando o @Transactional fosse omitido. Legal…