Forums Register Login

Why bean managed transaction is not allowed with entity beans

+Pie Number of slices to send: Send
I know that many people want to know the exact answer to the question "why BMT is not allowed with entity beans?". The answer was made clear to me after I reviewed Mastering EJB 3rd Edition by Ed Roman (pg 315). In a nutshell it is like this: in order to start a transaction the container calls ejbLoad() to acquire the locking and get the last copy of data from the database. Finally the container calls ejbStore() in order to update the database and commit the transaction. The point is that allowing the bean to start the transaction then this should happen inside of ejbLoad() (before acquiring the db lock) and it should be committed inside of ejbStore() (before releasing the lock). This implies that the container will call ejbLoad() and ejbStore() only once and exactly in this order. This actually doesn’t happen all the time and is possible that ejbStore() doesn’t get called at the end of the transaction (some container choose to cache the data between transactions). In this case one might get in a terrible situation when the transaction gets never committed.
+Pie Number of slices to send: Send
BMT is not allowed in CMP beans, or is not allowed in entity beans at all?
+Pie Number of slices to send: Send
Is not allowed in entity beans at all.
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 985 times.
Similar Threads
Search for Entity beans
A basic Question on ejbLoad and ejbStore
why entity bean cannot manage own transtaction while session beans can do this ?
Bean managed Transaction for Entity Beans
BMT with Entity beans
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:04:03.