This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
My projects uses few "Container Managed Persistent Entity Beans" and Message Driven Beans. My task is to remove EJBs and migrate them to Spring. I'm able to migrate MDBs to MDPs. Is there any way to migrate CMP entity beans to Spring? I googled for solution, but no luck.
First, is there a preferred persistence framework being used? Spring is really just the IOC framework - it delegates to other things for persistence - like direct JDBC, Hibernate, iBatis, etc. So you're not really going to migrate your EJB to "Spring" to do this, but migrate it to one of the persistence frameworks and then wire up connections between it and the rest of your app using Spring. Spring does supply classes like HibernateDaoSupport, JDBCDaoSupport, etc. for working with these persistence technologies through Spring.
Second, is it EJB 2.1, EJB 3.0, etc.? If it's 2.1 it's going to be more of a conversion process. If it's 3.0 you can re-use JPA annotated model objects through another JPA provider (such as Hibernate or TopLink) and use Spring's EntityManagerFactory.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Sep 19, 2008
1. As of now we are not using any ORM.
2. We are using EBJ 2.1.
OK - since you don't have an existing persistence mechanism in place - I'd suggest using something that supports JPA. It's a lot simpler than the alternatives, you just annotate classes with the tables they map to, and annotate methods/fields with the columns they map to. Theres a guide to Getting Started With JPA in Spring - it uses TopLink, but it's pretty trivial getting it to work in Hibernate.