When do CMP Entity Beans persist data?

Discussion in 'Java' started by Lord0, Aug 29, 2008.

  1. Lord0

    Lord0 Guest

    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
    Lord0, Aug 29, 2008
    #1
    1. Advertising

  2. Lord0 <> wrote in news:98393ad7-d293-4c00-9979-
    :

    > 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.
    Donkey Hottie, Aug 29, 2008
    #2
    1. Advertising

  3. Lord0

    Arne Vajhøj Guest

    Lord0 wrote:
    > 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
    Arne Vajhøj, Aug 29, 2008
    #3
  4. Lord0

    Lord0 Guest

    thanks for the replies guys
    Lord0, Sep 8, 2008
    #4
  5. Lord0

    Lord0 Guest

    thanks for the replies guys
    Lord0, Sep 8, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim

    Entity beans and CMP

    Tim, Jan 30, 2004, in forum: Java
    Replies:
    0
    Views:
    327
  2. Andrea Sansottera

    no cmp field defined in cmp ejb

    Andrea Sansottera, Jul 16, 2004, in forum: Java
    Replies:
    0
    Views:
    375
    Andrea Sansottera
    Jul 16, 2004
  3. Torsten Schmeissel
    Replies:
    0
    Views:
    406
    Torsten Schmeissel
    Apr 29, 2005
  4. Replies:
    1
    Views:
    284
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Jul 21, 2007
  5. markla
    Replies:
    1
    Views:
    531
    Steven Cheng
    Oct 6, 2008
Loading...

Share This Page