Discussions

EJB programming & troubleshooting: How to get reference of Remote EJB

  1. How to get reference of Remote EJB (1 messages)

    Hi, I am using JSF+EJB3.0+Oracle architecture(tiers deployed on 3 different machines) for my application. In JSF managed bean I have following two ways to deal with entity beans:

    1. Either to create instance of entity class with new in my Managed bean, populate it with values and send it to create() method of remote session facade for persistence.

    2. Call user-defined getNewObject() method on remote session facade which will create instatance of entity class and returns it to managed bean, then to populate it with values and again send same instance to create() method of remote session facade for persistence.

    I would like to know which one will be the best way. Please note that my 3 tiers are deployed on 3 different machines which may be in same network or may not be.

    Waiting for reply...

  2. Hi,

    I am not going to say one is better than the other. But I prefer your second approach due to following reasons.

    1) You might call a factory method available on the server side, and might be getting the same object reference at all the time.

    2) There may be default behaviours/properties set while you create the object in the server side. Therefore you'll get those while you create the object.

    Because of those reasons, I prefer your second approach.

    Asiri