4 Replies Latest reply on Sep 22, 2002 12:07 AM by psabadin

    Eficiency, CMR, CMP, Local IF, Lazy Loading, Pooling, EJBLoa

    psabadin

      Assume that all entity access is via Local interfaces (starting from a session facade) and in the same transaction, relies on lazy loading, uses CMR/CMP, etc. within JBoss 3.0.x.

      Is the following simulation of EJB inheritance with a fine-grained object model still a major no-no? I'm thinking that this approach is OK BECAUSE of the above mentioned container technologies. Please set me straight if I am messed up. (I would love to hear from dsundstrom as well.)

      Pseudo-code for EJB inheritance:

      public abstract class PatientBean
      implements EntityBean {

      ...

      // ejb-jar.xml not shown but assumed correct and optimal

      // CMR for Person simulating PersonBean BASE CLASS (delegation)
      public abstract void setPerson(PersonLocal lEntity);
      public abstract PersonLocal getPerson();

      // ? HERE IS THE QUESTION. THIS SIMULATES INHERITANCE
      // AND IS A CMP GETTER/SETTER FOR A BASE CLASS (Person) ENTITY
      // EJB ATTRIBUTE. IS THIS OK OR TRULY A SCALABILITY
      // ISSUE?
      public String getFirstName()
      {
      return getPerson().getFirstName();
      }

      public void setFirstName( String pFirstName )
      {
      getPerson().setFirstName(pFirstName);
      }

      // Typical CMP getter for derived (Patient) entity
      // (shown here for completenes and contrast);
      public abstract void setGender( char pGender );

      ...
      }

      Please keep it tight (answer only question asked) and don't go off topic for this post.

      Thanks in advance!
      Paul

        • 1. Re: Eficiency, CMR, CMP, Local IF, Lazy Loading, Pooling, EJ
          dsundstrom

          Yes encapsulation and delegation is the correct way to implement inheritance in EJB.

          • 2. Re: Eficiency, CMR, CMP, Local IF, Lazy Loading, Pooling, EJ
            psabadin

            Yahooooooooooo!!!! Almost-real OO is now on the server side. If all goes as planned, we should start seeing very sophisticated and feature-rich apps coming out of the J2EE world. And they will be built much more quickly.

            Thank you for the response.
            Paul

            • 3. Re: Eficiency, CMR, CMP, Local IF, Lazy Loading, Pooling, EJ
              dsundstrom

              I think you are overly excited about OO, but I have been proven wrong many times before.

              • 4. Re: Eficiency, CMR, CMP, Local IF, Lazy Loading, Pooling, EJ
                psabadin

                 

                "psabadin" wrote:
                Possibly overly excited - sorry about potential over-exuberance.

                ??? But this relates to my original reason for my post - i.e. IS THIS DELEGATED-INHERITANCE (GIVEN THE J2EE CONTAINER TECHNOLOGIES) A DANGEROUS APPROACH (FOR PERFORMANCE) IN JBOSS ???

                My intent is to code significantly (not purely) from an OO perspective. Object graphs (which result in significantly normalized DB schemas) would help immensely to maintain very complex biz logic. Then, intend to DE-normalize DB (and flatten object graph) as performance bottlenecks rear their ugly heads. Going in this direction (OO -> flat) is much easier during development than having flat and unmanageable spaghetti code. Just like the old rules for writing assembly - make it WORK first - THEN optimize.

                LUV 2 HEAR WHAT U THINK (ANY OTHERS' INTELLIGENT DIALOG ALSO APPRECIATED)

                Paul