Announcement Announcement Module
No announcement yet.
best practice for migrating from EJB session beans to Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • best practice for migrating from EJB session beans to Spring


    we have an EJB based application using session EJBs with CMT and Hibernate for persistence. We like to migrate to Spring to make the session beans runable in standalone mode for better testing and development without deployment.

    Now we are locking for the best way to do this with the minimal need for changing the classes using the session beans.

    I read many articles on the web but they didn't answer all my questions. The main problem is that we use many session beans remote from a swing client by the remote interface and local in the application by the local interface. The normal way to integrate spring with EJB would be the following (please correct me when Im wrong):
    1. Create the business interface (like our local interface without EJB specific stuff)
    2. Create the implementation (like our bean class without EJB specific stuff)
    3. Create a facade bean extending AbstractStatelessSessionbean implementing the business interface with delegate methods.
    4. Create a facade interface extending the business interface and EJBLocalObject without any methods declared, just for use in the EJB deployment descriptor.
    5. Now I can access the bean remotely with a SimpleRemoteSessionProxyFactoryBean and localy with a LocalStatelessSessionProxyFactoryBean.

    Is this right so far?


    1. Right now we use util classes generated by xdoclet for the retrieval of the homes (local or remote):
    Remote: ClassXYZS xyz=ClassXYZSUtil.getHome().create();
    Local: ClassXYZSLocal xyz=ClassXYZSUtil.getLocalHome().create();
    I would like to keed the util classes. Than I dont have to change all the creation code all over the system. How can I do that? What is the replacement for the home in spring?

    2. Do I realy only need a local Interface anymore (step 4 above)? Can I access the session bean remotely and local only by switching between SimpleRemoteSessionProxyFactoryBean and LocalStatelessSessionProxyFactoryBean?

    3. Do I need transaction declarations in the spring configuration if the session bean is running inside an application server. Is it enough to declare the transaction needs in the ejb deployment descriptor?

    4. Can I use spring session beans running inside an application server without declaring session beans in the ejb deployment descriptor (just spring session beans, not EJB session beans)? If yes, could I access these spring session beans local and remote? Waht do I need for that?

    5. Is there somewhere an example or tutorial how to use spring with EJB with remote and local access to session beans with transaction declaration?

    Thanks in advance for your help and please excuse my poor english.