6 Replies Latest reply on May 14, 2002 11:49 AM by scruntime

    Eager/lazy loading of EJB 2.0 relationships

    zetzet

      Hi,

      i'm wondering if there is any way to signal JBoss 3.0alpha that
      the server should/shouldn't load the "many" side of a
      1:n relation eagerly.

      Any hints?

      Bye,

      Jürgen

        • 1. Re: Eager/lazy loading of EJB 2.0 relationships
          fred

          Use the eager-load/lazy-load descriptor directives, cf. JBoss 3.0 manual CMP 2.0 appendix.

          • 2. Re: Eager/lazy loading of EJB 2.0 relationships
            dsundstrom

            JBossCMP alpha does not support eager or lazy loading of relationships. I plan on adding support eager/lazy loading of relationship foreign keys, but that would not apply to the many side of a one-to-many relationship.

            So the question is what are you seeing?

            -dain

            • 3. Re: Eager/lazy loading of EJB 2.0 relationships
              zetzet

              Hi,

              > JBossCMP alpha does not support eager or lazy loading
              > of relationships.
              > [..]
              > So the question is what are you seeing?
              From our experience, the strength of an EJB
              CMP implementation can be measured looking at
              the "500 list items" case:
              What happens when an entity (e.g. an Invoice) has
              a larger (but still reasonable) count of dependent
              entities (e.g. InvoiceItem's).

              Does the CMP engine generate 1+1+500 JDBC calls
              or 1+1 (or anything < 10) JDBC calls?

              EJB CMP 2.0 (local interfaces + relationships) is
              the first EJB standard that comes close to
              a reasonable persistence layer, but of course
              this doesn't help if your CMP implementation
              makes "usual" relationships (>10 but < 10000)
              unusable from a performance standpoint.


              Bye,

              Jürgen

              • 4. Re: Eager/lazy loading of EJB 2.0 relationships
                dsundstrom

                > From our experience, the strength of an EJB
                > CMP implementation can be measured looking at
                > the "500 list items" case:
                > What happens when an entity (e.g. an Invoice) has
                > a larger (but still reasonable) count of dependent
                > entities (e.g. InvoiceItem's).

                ok

                > Does the CMP engine generate 1+1+500 JDBC calls
                > or 1+1 (or anything < 10) JDBC calls?

                Currently, I think it does the 500 calls, but none of the cmr code has been optimized yet. CMR in the alpha is in the prove that it works phase. I hope to have support for relationship readahead code in the next alpha.

                > EJB CMP 2.0 (local interfaces + relationships) is
                > the first EJB standard that comes close to
                > a reasonable persistence layer, but of course
                > this doesn't help if your CMP implementation
                > makes "usual" relationships (>10 but < 10000)
                > unusable from a performance standpoint.

                Now that is not very nice. This is a group effort, so if you find a performance problem bring it to our attention (the more detail the better). Then help think of a solution, but under no circumstances are you just allowed to bitch about "your CMP implementation."

                • 5. Re: Eager/lazy loading of EJB 2.0 relationships
                  zetzet

                  Hi,

                  > think of a solution, but under no circumstances are
                  > you just allowed to bitch about "your CMP
                  > implementation."
                  SORRY!
                  I really didn't want to say anything bad about
                  Jboss, and the "your" in my e-mail was perhaps a
                  bad wording (i'm not a native speaker): it should
                  not mean the "JBoss implementation" but "the
                  CMP implementation you use in your application".

                  Bye,

                  Jürgen

                  • 6. Re: Eager/lazy loading of EJB 2.0 relationships
                    scruntime

                    Has this (lazy loading) now been implemented in JBoss 3.0 RC1?

                    Can you achieve the same effect by using BMP and integrating with Castor as described here:

                    http://www.jboss.org/developers/jboss-castor.jsp

                    thanks very much

                    Steve