1 Reply Latest reply on Nov 6, 2007 7:09 AM by christopher_p

    EJB 2.x CMP and EJB 3.0 JPA Coexistence

    christopher_p

      Hi there,

      I'm a current user of EJB 2.x running on JBoss 4.0.4. My organisation are starting to upgrade to JBoss 4.2.x and we're looking to move our application to EJB 3.0.

      I've already done considerable research on EJB 3.0, and in particular migration strategies from 2.x. I'm satisfied that we will be able to migrate our session beans gradually by preserving our [Local]Home interfaces so that 2.x clients can continue to use the 3.0 beans.

      However, one thing that I've not been able to find a definite answer to is how well EJB 2.x and EJB 3.0 entities coexist. In particular: if I have an EJB 2.x CMP "Customer" entity, and I perform operations on it to manipulate the underlying Customer table, what happens if I concurrently use the JPA EntityManager to also manipulate the Customer table? Do CMP and JPA use the same transaction service (JTA?) and operate as if I was simply using two CMPs, or two EntityManagers? Or do the two opposing persistence mechanisms conflict with each other in some way?

      Your advice, or any resources you can point me to, would be much appreciated.

      Cheers,
      Chris Paton

        • 1. Re: EJB 2.x CMP and EJB 3.0 JPA Coexistence
          christopher_p

           

          "Christopher_P" wrote:
          However, one thing that I've not been able to find a definite answer to is how well EJB 2.x and EJB 3.0 entities coexist.


          Ah ha! Today's search was more fruitful: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=72369. Bill Burke states that it is in fact dangerous to mix CMP and EJB 3.0 persistence. Not the answer I was hoping for but an answer nevertheless.

          The web still seems fairly thin on migration strategies from CMP to JPA/EJB 3.0 persistence. As it stands it seems like the only option is to migrate all entities at once (!). Any useful resources would be most welcome.

          Cheers,
          Chris Paton