Discussions

General J2EE: Some opinions about EJB 2.0.

  1. Some opinions about EJB 2.0. (3 messages)

    1. RemoteException should be substituted by another RUNTIME exception so as to alleviate the work of a EJB programmer.
    Why? Thinking a programmer calling EJB in some code segament, he should catch every RemoteException with each remote call. However, this is a meaningless atempt because it seldom occurs and even it occurs, it isn't caused by manual or data-relating reasons. So, RemoteException is just like OutOfMemoryException, which is an obvious RUNTIME exception not requring programmers to catch.

    2. EJBLocalObject/EJBLocalHome shouldn't be necessary for a programmer to code. Everyone could see that methods in a local interface are identical to those in the relevant remote interface. Why doesn't the container directly compile the remote interface it a remote stub and a local stub? More than that, the container can intellegently choose remote or local interfaces to return to a client.
    eg. If looking up home by "new InitialContext()", it returns the local home, while return remote home for "new InitialContext(serverProperties)".

    Expecting your comment eagerly.

    Threaded Messages (3)

  2. Some opinions about EJB 2.0.[ Go to top ]

    I don't necessarily disagree with number #1, but I have big problem with #2.

    The local and remote interfaces DO NOT HAVE TO BE THE SAME. That's the whole point! If you don't want your bean to have a local interface, or a remote interface, you don't write them. Whilst the tools might be able to save you some time here that would probably complicate an already overly-complex EJB deployment task.

    Also, new InitialContext() is just a convenience method when you want to access something in the same container, it doesn't necessarily imply that you want it's local interface. What does "new InitialContext()" do in a clustered environment???

    Chz

    Tony
  3. Some opinions about EJB 2.0.[ Go to top ]

    Thank you for your commentary.
    But I think you must have misunderstood my opinion.
    By #2, I mean programmers needn't concern much about whether the EJB is local or remote.
    No matter whether it is on the local JVM, or on any other JVM(maybe by cluster), one can easily call it using a uniformed interface, while the intellectual selection of the proper stub is handled by the container.
    Do you still agree?
  4. Some opinions about EJB 2.0.[ Go to top ]

    I still disagree. The semantics of local versus remote interfaces are different. Pass by value versus pass by reference. This is most definitely something programmers should care about.

    A uniform local and remote interface is just one possible way you might choose to use the technology, but it is far from being the only one.

    Chz

    Tony