2 Replies Latest reply on Apr 23, 2004 10:23 AM by starksm64

    Basic question about helper classes naming

    balteo

      Hello,

      I am building a pretty basic multi-tier application. I want to reduce a much as possible the dependencies between the web tier and the ejb tier. Ideally I would like for the web tier to construct a request object (of class MyRequest) and send it to the ejb tier that would then return a results object (of class MyResults).

      These would therefore be the only two classes that BOTH the ejb and web tier would be aware of. All other classes would either belong to the web tier OR the ejb tier.

      My question relates to the naming of these two classes. I would like to have different package names for the two classes as follows:

      -web-tier request object will be of type com.mycompany.web.MyRequest
      -ejb-tier request object will be of type com.mycompany.ejb.MyRequest

      -web-tier results object will be of type com.mycompany.web.MyResults
      -ejb-tier results object will be of type com.mycompany.ejb.MyResults

      I am getting errors with that. Is there a way around it? How can I have the different package name and the class appear to be the same?

      Thanks in advance,

      Julien Martin.

        • 1. Re: Basic question about helper classes naming
          darranl

          You can't

          • 2. Re: Basic question about helper classes naming
            starksm64

            That is in violation of the java type model and cannot be done trivally. If you setup a call by value stack between the web and ejb tier, an alternate object could be used for serialization using:

            Object writeReplace() throws ObjectStreamException;
            Object readResolve() throws ObjectStreamException;
            


            but this is going to be difficult to maintain and would make your ejbs only usable by your web tier.

            Generally what you asking for makes little sense so rethink why you want this.