Results 1 to 3 of 3

Thread: Injecting a POJO into an EJB3 SLSB with Spring 2.0.8

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Default Injecting a POJO into an EJB3 SLSB with Spring 2.0.8

    Hello,

    I want to inject a POJO into an EJB3 Stateless Session Bean with Spring 2.0.8 (I have to stick with this version because of JDO 1.0 compatibility).

    I have found some resources on the net but no complete example, so I'm missing the big picture. Basically I have a Service-Interface "Service". This interface is implemented by the "ServiceImpl"-Pojo and the EJB. The EJB is called by a Java client and delegates all service calls to the service implementation. I understand, that I should use the Configurable annotation to inject the "ServiceImpl" - POJO into my EJB, so my classes look like this:

    Service:
    Code:
    public interface Service
    {
       public String sayHello();
    }
    ServiceImpl:
    Code:
    public class ServiceImpl implements Service
    {
       public String sayHello()
       {
           return "Hello World!";
       }
    }
    ServiceEJB:
    Code:
    Configurable
    Stateless
    Remote(Service.class)
    public class ServiceEJB implements Service
    {
        private Service service;
    
        public String sayHello()
        {
             service.sayHello();
        }
    }
    I guess that the Configurable annotation causes Spring to instantiate a bean-factory in the background, but what I do not understand is where it is looking for the configuration file?

    So I'm a bit confused how these components are "glued" together and what effects the Configurable annotation really has.
    I hope that someone can help me.

    Thank's in advance!

  2. #2
    Join Date
    Mar 2009
    Posts
    2

    Default Looking for some example application using Spring and Hibernate

    Looking for some example application using Spring and Hibernate

    Guddu

  3. #3
    Join Date
    Mar 2009
    Posts
    2

    Default Can I use EJB3 and Hibernate as Persistence mapping?

    Can I use EJB3 and Hibernate as Persistence mapping?

    Thanks,
    Guddu
    http://www.interview-questions-tips-...xample/Example

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •