-
1. Re: EJB CMP/CMR 2.1 to 3.0 migration
bill.burke Mar 13, 2005 11:49 AM (in response to duncow9000)EJB 2.1 is a very different model than 3.0. Migration steps? Here's some pointers:
1. Homes/Finders. Turn Home interfaces into Stateless session beans. Finder implementation just turn into queries on the EntityManager. create method implementations turn into session bean methods with new() and EntityManager.persist().
2. CMR: There is no CMR. Since Entities are POJOs you have to wire them up yourself just as you would any other plain Java object with relationships that wasn't persistent. This is the biggest pain, but if you want POJO persistence, then your persistent objects need to act like POJOs.
3. EJBQL. EJBQL 3.0 is a superset of EJBQL 2.1. So no issues here.
You'll find that since Entities are POJOs, even with the extra work of creating DAOs (step 1), you'll find that it simplifies interactions with clients as you don't have to implement the ValueObject pattern.
Any other concerns?
Bill -
2. Re: EJB CMP/CMR 2.1 to 3.0 migration
duncow9000 Mar 13, 2005 6:30 PM (in response to duncow9000)My main concern is interoperability. I don't want to migrate our entire system in one go, but the entities in our system are so closely interrelated via CMR, I wonder whether I have any choice.
Supposing I have a 2.1 Employee entity that has a many-to-one CMR relationship to Company. I'd like to convert both Employee and Company to 3.0, but there is another entity, Customer, that has a many-to-many CMR relationship with Company. I don't want to change Customer right away.
Can I convert Employee to an Entity POJO without also converting Company and Customer? Or convert only Employee? Should I write a stateless session bean for Company and use that in 3.0-land while retaining home interfaces and CMR for the 2.1 parts of the system and the Customer relationship?
I'm just not clear on whether I can expect to get the CMR and 3.0 persistence to work on different relationships in the same entity. If I can't, then it seems to me I have to convert every entity in the network of CMR relationships until I have expunged CMR completely. And then our 2.1 to 3.0 migration effort becomes a very long branch, rather than being done in smaller chunks on the main development path. I like smaller chunks.
That's why section 9.2.4 in JSR220 caught my eye -- it seems like the door is open to forms of interoperability beyond what has already been discussed.
Or maybe I'm barking up the wrong tree. Whatever the case, I'd be very happy to be set straight.
Thanx
Kevin