Announcement Announcement Module
Collapse
No announcement yet.
Some Doubts regarding EJB's Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some Doubts regarding EJB's

    Hi Guys:

    I am new to Spring. I know how the EJB's work with spring (somewhat manually ). I can write a program with the help of the reference manual. But the concepts are really hard to understand. I have not read the refernce document completely (due to time factor). Let me put the questions, hope u all can jump in and give me clues, references or ur thoughts what ever u may have, so that i can take it from there.

    In my application i have written a business interface, provided an implementation classes and the SLSB his written as documented in the reference manual extending the Buisness Interface Impelementation classes.

    1) Assuming EJB's are configured properly, when we access the spring framework it give us an instance of implementation of Business interface (POJO). How are the EJB's instantination handled? I mean the remote objects, how are they mapped to this POJO implementation class?

    2) How the same process works with EJB Session Beans? As you know session beans can maintain State, but how this works out here

    3) How is the persistence handeled? ejbActivate or ejbPassivate functions are handeled ??

    4) As you all know remote objects are stubs, so the spring framework which give the POJO implementation instance can be exported to another JVM.??

    5) Can we integrate the Spring Framework with Entity beans? i know this is done with ORM, but still curious to know it if i have already have a Entity bean written, then how to do it?

    6) What are the different Design patterns used in the Spring framework? I will name a few, hope everyone can add new ones if they have come across
    a) Dependecy Injection Pattern
    b) Buisness Methods Interface

    Using Spring framework we need not follow these patterns as these are followed by Spring --
    a) Service Locator
    b) Buisness Delegate

    I personally beieve that knowing the design patterns that spring framework implements or helps in overcoming, can certainly provide enough information of Spring frame work

    6) Which are the chapters in the ref manual that we should go through to make us completely understand the spring framework integration with Enterprise Java beans.

    7) I have seen the spring samples, but could not find a complete example show casting how the spring can be integrated with EJB's (SLSB, SFSB, MDB's and Entity beans). Does any one has any references?

    Thanks in advance

    Cheers
    Rajesh S.

  • #2
    Do you actually need to use EJBs in your application? Rod Johnson's "J2EE Development without EJB" provides a 550-page examination of the questions you asked in your post. It would be ambitious to try and distill such an extensive work into just a few words here. Nevertheless......

    Basically, the only times I've seen EJBs used with Spring is when there are existing applications with large investments in EJBs. In practice:

    - Entity beans are rarely used in reality. Most real EJB applications used direct JDBC or ORM such as Hibernate. So worrying about entity bean integration is probably unnecessary.
    - There's no real need for SLSBs or SFSBs. Simply use a stock-standard POJO via an IoC container.
    - MDBs are also no longer really required. On a recent project I used asynchronous request-reply JMS with a message-driven POJO, with proper transaction demarcation and message consumption.

    Did you have a specific architecture in mind, and were wondering if you'd need a particular type of EJB? If you post it here, people will be happy to offer observations and share experience.

    Comment


    • #3
      Hey Ben:

      Thanks for your reply. I dont have the book, Rod Johnson's "J2EE Development without EJB" that you where referencing. I will try to get one and have a look into that.

      The reason to refernce EJB's with Springs is that, at present i am working OpenSource Liferay Portal Server which is JSR-168 compliant portal server. In that they have sucessfully integrated with Springs. All the Business objects are created using POJO, and exposed as Stateless Session bean. The persistence layer is Hibernate. So that is the reason which is making me to put all the questions .

      Some what i am able to make a progress regariding exposing POJO objects as remote objects. But still the basic question still there ....

      In case of RMI/EJB's how the service exporter is able to generate all the stub and skeleton classes for simple POJO beans and export it as a RMI/EJB service. Eventhough if we assume somwhow it is created, how to get the stubs to make them work with traditional RMI/EJB client programs. Hope you are understanding me

      I am concerned with distributed programming. How Spring make this happen internally to get this objective done.

      Let me know if you have any ideas. Let me know if you are not clear.

      Thanks
      Rajes Shiggaon

      Comment


      • #4
        Originally posted by rajesh_shiggaon
        In case of RMI/EJB's how the service exporter is able to generate all the stub and skeleton classes for simple POJO beans and export it as a RMI/EJB service. Eventhough if we assume somwhow it is created, how to get the stubs to make them work with traditional RMI/EJB client programs.
        Spring's RmiServiceExporter effectively doesn't create stubs or skeletons. It rather exposes what we call an "RMI invoker": a special RMI stub that allows any invocations to be passed through it. On the client side, Spring's RmiProxyFactoryBean creates corresponding proxies that know how to pass service invocations through that RMI invoker.

        Alternatively, you can also use RmiServiceExporter for traditional RMI services. In that case, you need to run "rmic" for your target service, just like with traditional RMI programming. The exposed service will be a plain RMI service then, compatible with any RMI client (Spring's RmiProxyFactoryBean or traditional RMI lookup).

        In the case of remote EJBs, you need to implement the remote EJBs as usual. Internally, you might talk to a Spring BeanFactory/ApplicationContext and fetch Spring-managed beans from there, delegating work to them. Spring just serves as backend infrastructure here, not affecting the actual EJB handling.

        Juergen

        Comment


        • #5
          Originally posted by Ben Alex
          - MDBs are also no longer really required. On a recent project I used asynchronous request-reply JMS with a message-driven POJO, with proper transaction demarcation and message consumption.
          Ben,

          Can you provide some more insight in how you implemented the MDB replacement? Also what are good replacements for the remoting facilities that EJB containers provide (I still need a remote API since calls to my systems are usually done across system boundaries).

          Comment

          Working...
          X