Announcement Announcement Module
No announcement yet.
businessInterface of calling EJB from Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • businessInterface of calling EJB from Spring


    i want to know the class specified at "businessInterface" at the xml configuration should be newly created by me or reference to another file.

    the following is an example and i'm not sure the class stated at the businessInterface attribute referring to a new java class or from existing EJB file.

    if it's a new java class, another rules/guideline for that interface class?

    <bean id="paymentService" class="org.springframework.ejb.
    <property name="jndiName">
    <property name="businessInterface">
    <value>com.springinaction.payment.PaymentService </value>

  • #2
    Take a loot at my posts in this thread

    Basically you create your business interface by hand and then generate the EJB interface (and home) using XDoclet. If you do that part by hand as well, you would have to create two interfaces, one business and one remote.


    • #3
      Am i correct that if the EJB is developed by third-party,

      1. i need to ask them for the EJB Home interface
      2. based on their interface, i create my own Business Interface which should be specified at xml configuration file's businessInterface?
      3. finally, create two standard spring java files, and to encapulate the business.

      therefore, at this situation, only need to write 3 java files then.

      thanks a lot!


      • #4
        BTW, you don't NEED to write a business interface. If you are using a 3rd party library that is designed as a remote object, you might consider using it as such. When I find it useful to use a business interface is when I have the ability to choose how I call it (using EJB, RMI, other remote strategy or as a local class). So if your 3rd party library isn't offering you that flexibility, it may be extra work.

        I guess it depends on how you like to write your client code. If you don't like to put try/catch for RemoteException for every call, then using a non-EJB business interface will make it cleaner.


        • #5

          indeed, i still want to have the flexibilty as one day we may not use that 3rd EJB, we may implement in our own EJB or POJO and etc.

          therefore, want to have a better architecture with Spring at the design and first stage.

          at this consideration, am i required to have it? if possible, please state specifically, sorry that i'm quite new at this scenario and don't have a very clear picture even read the reference manual .... : <


          • #6
            You are not required to have a business interface. What having a business interface gives you is it removes the RemoteException from the signature of a remote bean. You can still catch a remote exception. Spring just converts the one from EJB interface into an unchecked one.

            By keeping your business object agnostic to its actual transport (in this case EJB) then when you change the implementation (like converting remote EJB to local object or another remoting strategy) you don't have to change your client code.


            • #7
              then what does the attribuate "businessInterface" at the XML refer to then?


              • #8
                It is the interface the created proxy implements. Either it is your business interface (if you have one) or it is the remote interface itself.