0 Replies Latest reply on May 29, 2007 1:46 AM by Mateusz Mrozewski

    desing pattern for remote accessing

    Mateusz Mrozewski Newbie

      Hello,
      I am looking for correct design pattern which will allow me to access data via EJB remotly. I want to have a single point of enterance both for SEAM application and for other applications, which use the same data.

      My current idea is to have:
      - Stateless EJB acting as a DAO
      - Stateful EJB, acting as a seam action
      - JSF as a presentation layer

      The stateful EJB calls the stateless to get the data. It also additionally has a remote interface which allows other application to call it. Due to convetions of seam I have to "double" the interface, for example:

      @DataModel
      private List<Contact> contacts;
      
      @DataModelSelection
      private Contact contact;
      
      @Factory("contacts")
      public void findAll() {
       if(contacts == null) {
       contacts = myStatelessBean.findAll();
       }
      }
      
      public List<Contact> getContacts() {
       findAll();
       return contacts;
      }
      


      I find this sollution quite innatural, because you have to implement two interfaces, which do quite the same thing. The other idea is to develop a facade, but it introduces another problem: passing parameters and returning values - it is done by @In and @Out annotations in seam. You will have to call additional methods from facade to set parameters and get the returning values.

      Which sollution is better? Maybe you know a better sollution for this problem?

      thx