facebook

J2EE application design

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #227671 Reply

    Jason Price
    Member

    I have several applications and a set of stateless session beans that we use for our business logic.
    We are having trouble when it comes to updates.
    Most of the clients we develop access these ejbs.

    for example:
    We have a customer ejb that has methods for retrieving customers details, allocated order, history, etc.
    Obviously lots of client applications need access to this and to include the EJB in each application is pointless.

    It works when the application is deployed as an EJB project and the client apps access its remote interface.

    However when we change another ejb that is in the same project (say the related stock ejb), the client apps need to be redeployed as the DTO the ejbs return have been recompiled to redeployed the EJB project. One solution I can think of is to return a Hashmap instead of a DTO so the webapps have no dependency on any Custom DTO classes and therefore the client apps cannot go stale.

    I am interested to know how everyone else deals with this sort of common code?
    What does everyone else do?

    #227684 Reply

    Riyad Kalla
    Member

    Funky you’ve had quite a few good questions recently that peak my interest.

    Anybody?

    #227706 Reply

    Jason Price
    Member

    I know…I really need to get this sorted (I’ve been posting to the jboss forums as well) but no one seems to have any answers!

    #227723 Reply

    Riyad Kalla
    Member

    Maybe you are too smart for your own good?

    #227835 Reply

    tojx
    Member

    Your problem can be solved by making use of the interfaces. That’s what they’re there for.
    When you change your beans and the bean interfaces are not changed, you don’t need to redeploy the clients.
    Being a good programmer you define your interfaces in a way that they don’t change. If for some reason you need to change them, e.g. if you add another method you’d obviously need to redeploy all clients as well.

    But even this can be avoid by simply subclassing the interfaces. If a client needs new methods on the interface you can simply create a new interface for the bean, extending the existing interface. Then the client can access the new methods using the new interface while all old clients who do not need this new method can access the old interfaces.

    Not sure if this helps, as this solution is probably too simple?

    ps: I wouldn’t use the hashmap solution because you’d need to typecast all over the place – the project would become harder to maintain and you’d most likely introduce new bugs.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: J2EE application design

You must be logged in to post in the forum log in