This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes How to migrate CMP Entity Benas to Spring? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to migrate CMP Entity Benas to Spring?" Watch "How to migrate CMP Entity Benas to Spring?" New topic
Author

How to migrate CMP Entity Benas to Spring?

Siva Krishna
Greenhorn

Joined: Sep 19, 2008
Posts: 4
Hello,

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.

Can anyone help me here?

Regards
Siva Krishna. K.


Regards
Siva Krishna.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Two questions...

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.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Siva Krishna
Greenhorn

Joined: Sep 19, 2008
Posts: 4
Hello Nathan,

1. As of now we are not using any ORM.
2. We are using EBJ 2.1.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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.
 
 
subject: How to migrate CMP Entity Benas to Spring?
 
Similar Threads
Session bean tranasactions with CMP
CMP and DAO...
Why bean managed transaction is not allowed with entity beans
Writing test case without database operations
Business Tier Technologies mock question?