When do CMP Entity Beans persist data?

L

Lord0

Hi there,

I've inherited a Struts app running on OC4J/Oracle 10g which uses CMP
Entity beans to handle reading/writing data from the DB.

My question is: WHEN does the container write the data in the beans
back to the DB? (I believe it decides "itself" when to do this)

Cheers

Lord0
 
D

Donkey Hottie

Hi there,

I've inherited a Struts app running on OC4J/Oracle 10g which uses CMP
Entity beans to handle reading/writing data from the DB.

My question is: WHEN does the container write the data in the beans
back to the DB? (I believe it decides "itself" when to do this)

Cheers

Lord0

If there is a session bean managing the entity beans, the transaction
begins when you "enter" a method in that session bean. It ends when you
exit the method.

I think the container have to write the data at least just before the
transaction ends.
 
A

Arne Vajhøj

Lord0 said:
I've inherited a Struts app running on OC4J/Oracle 10g which uses CMP
Entity beans to handle reading/writing data from the DB.

My question is: WHEN does the container write the data in the beans
back to the DB? (I believe it decides "itself" when to do this)

When the transaction in the EJB container commits succesfully, then
the database update must go through. Even though the EJB specs may
not say how, then I can not see any other way of achieving that
than having the EJB tx commit do a DB tx commit.

The EJB spec also has a little figure that shows a commit to
the database at that point.

With a common EJB config the EJB transaction will commit after the
outermost session bean method call exits before returning to
client.

Also note that if other apps are accessing the data, then you need
to look at the CMP beans deployment descriptor - more specifically
commit option A, B and C.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top