0 Replies Latest reply on Nov 22, 2010 7:10 AM by Martin Höller

    Seam and remote access to Enterprise Java Beans

    Martin Höller Newbie


      I've already posted this in the Seam 2 forum, but since it's a basic question to the concept of Seam (not specific to any Seam version) I'm reposting here.

      We have a JEE application that implements most of it's business logic in EJBs (stateful as well as stateles beans). Currently all our EJBs implement the local and the remote interface at the same time. Here is an example of a DAO:

      public interface PersonDAOLocal {
        // ...
      public interface PersonDAORemote {
        // ...
      public class PersonDAOBean extends AbstractDAO<Person, Long>
        implements PersonDAOLocal, PersonDAORemote
        // ...

      We have two user-interfaces to the application: a web UI and a java native client. In the webapp we are using Seam. At them moment we don't use Seam-managed persistence context (SMPC), but we would like to (as it's recommended in so many places).

      The problem we currently have with SMPC is that if we activate it, our SFSBs and SLSBs which then get the PC injected by Seam, can't be used by remote clients any more. In the webapp everything is working fine, but every call to a SFSB from a remote client gets a new PC, as there is no seam conversation that could hold the PC across multiple RMI calls.

      This situation seems totally logical (after some deeper analysis), but isn't there some way to take advantage of SMPC even in remote clients? The only relevant topic I could find is this one: http://seamframework.org/Community/RemoteEJBInvocationsAndSeamsSessionContext Unfortunately it is highly hypothetical and would include patching Seam :(

      The solutions that came to our mind so far are the following:

      • Don't use SMPC.

      • Inject a SMPC as well as a PC managed by the container and add some logic in the EJBs to use the suitable PC depending on the type of the call (local vs. remote).

      • Split local and remote implementations of the EJBs. Use SMPC for local implementation and CMPC for remote implementation.

      • Add some kind of Seam-conversations for remote clients (as mentioned in the link from above).

      Isn't that a common problem to JEE applications with Seam?

      How do others solve the problem of remote clients and Seam applications?

      Many thanks in advance,

      - martin