Forums Register Login

Entity bean passivation by container

+Pie Number of slices to send: Send
Hello friends,

i've a doubt regarding entity bean passivation.

According to EJB Spec 2.0 , the
container can passivate the entity bean in middle of transaction.
The following is paragraph from ejb spec.

"The container can choose to passivate an entity bean instance within a
transaction. To passivate an instance, the container first invokes the
ejbStore method to allow the instance to synchronize the database state
with the instance's state, and then the container invokes the ejbPassivate
method to return the instance to the pooled state."

So if container passivate the bean in middle of transaction then it would
invoke the ejbStore method and would update the database. So we are
updating the database with-out knowing the transaction result ( commit or
rollback ) In case of rollback, it would put the database in inconsistent
state.

Could any one please explain it ?
+Pie Number of slices to send: Send
Hi Sabari,

The point is the following:

(1) Storing something in the database means:

UPDATE data_info SET TITLE='Volcanos' WHERE ID = 100005; (=ejbStore)

(2) finishing a transaction means:

COMMIT

After (1) is running nobody else can see a change on the database until (2) runs (depending on your isolation level). The container may passivate your bean between (1) and (2).


Hope this helps

Severin
+Pie Number of slices to send: Send
thanx for ur response.

what i get from ur reply is this..
once the container acquires the lock for a particular row in the database for a transaction, the lock will be released only after the transaction completes, no matter whatever happens with passivation..am i right ???
+Pie Number of slices to send: Send
yes, that's correct. Notice that "passivation" in Entity Beans is not the same as passivation in Stateful Session Beans. For Entity Beans it's only a "change of their role", not a "swap out to disk", although their state may be written to the disk too in ejbStore().

Severin
Paddy spent all of his days in the O'Furniture back yard with 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 617 times.
Similar Threads
Entity bean - passivated in a TX !
Entity Bean - ejbPassivate()
queries
Passivate in entity bean within transaction
Confirmation About Transaction
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:37:41.