There are some good explanations of EJB Transaction Attributes (and annotations) out there, for example, OpenEJB's.
But sometimes when I try to cover this with someone who hasn't worked with many transactional resources, I see their eyes start to glaze over.
So my question - how would you explain EJB Transaction Attributes to your grandmother?
I'm thinking a contrived example, analogy, or a concise real-world use case would be helpful.
ejb. TransactionAttributeType constants. If you decorate the enterprise bean class with @TransactionAttribute , the specified TransactionAttributeType is applied to all the business methods in the class. Decorating a business method with @TransactionAttribute applies the TransactionAttributeType only to that method.
A transaction attribute controls the scope of a transaction. Figure 27–1 illustrates why controlling the scope is important. In the diagram, method-A begins a transaction and then invokes method-B of Bean-2 .
Yes, CONTAINER and REQUIRED are the default.
EJBs support two types of transaction management: container managed and bean managed. Container managed transactions provide a transactional context for calls to bean methods, and are defined using Java annotations or the deployment descriptor file ejb-jar. xml.
You can think of them in terms of Collaboration. Let's say you are a chef, and you have a dozen ovens to work with. You need to bake some cakes. For this example, you are the called method, the oven is the transaction and the your boss is the caller.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With