2 Replies Latest reply on Jan 7, 2008 2:47 PM by Parragh Szabolcs

    Entity/Session bean coupling

    Parragh Szabolcs Newbie

      Hi All,
      I tried to google about my question and search the forum, but found no answer -- there might be, though, sorry if so!

      I'm building an application that will need both a SWing and a web UI. I decided to use Seam, because of the great features it has.

      It seems to me, however, that this way my Sesson beans have to be to closely coupled to the web UI, and won't be available to be called from the Swing UI.

      Entity beans contain data about the contexts, that's no more that a bit disturging, since the swing clients can simply ignore that. But the session beans returning FacesMessages, and string values to manage the page flowm in and outjecting etc. -- that is too close coupling for me.

      My question is: is there a pattern that could be used in these cases? Like introducing a new layer for the web to access the commonly used session beans? Or anything like that?

      Thanks in advance!
      PSz

        • 1. Re: Entity/Session bean coupling
          Pete Muir Master

           

          "parszab" wrote:
          It seems to me, however, that this way my Sesson beans have to be to closely coupled to the web UI, and won't be available to be called from the Swing UI.


          Not really, you just need to separate the concerns of your app properly (this is a case when some layering would be beneficial).

          Entity beans contain data about the contexts, that's no more that a bit disturging, since the swing clients can simply ignore that.


          They certainly don't have to (and I prefer they don't, this was something we experimented with early on and have since swung away from, preferring to manage the entity beans using a Seam manager component like EntityHome and a factory).

          But the session beans returning FacesMessages, and string values to manage the page flowm in and outjecting etc. -- that is too close coupling for me.


          So, keep your business logic in e.g. EJBs, and provide two facades, one for Web apps using Seam and one for Swing using whatever you want. (Btw Seam doesn't really support Swing at all as a front end).

          • 2. Re: Entity/Session bean coupling
            Parragh Szabolcs Newbie

             

            "pete.muir@jboss.org" wrote:

            "parszab" wrote:
            Entity beans contain data about the contexts, that's no more that a bit disturging, since the swing clients can simply ignore that.


            They certainly don't have to...


            Good to know, thanks! I guess "@Name"-s might be still necessary in some cases, though...

            "pete.muir@jboss.org" wrote:
            So, keep your business logic in e.g. EJBs, and provide two facades, one for Web apps using Seam and one for Swing using whatever you want. (Btw Seam doesn't really support Swing at all as a front end).


            If I'm right that means the introduction of an Action layer for the web UI. That bothers me only because this way I'll lose the availability of attached Entity beans. In this scenario PersistenceContext should go into the Session beans and not the Action POJOs. That is acceptable, but a bit said to sacrifice one of Seam's great advantages for pure design. :)