2 Replies Latest reply on Oct 29, 2003 4:54 PM by Ivan O. Parra

    PM CMP/CMR behavior.

    gsarno Newbie


      I re-posted this from another JBOSS forum as I think this might be the most appropriate:

      I have some import question about the PM manager on JBOSS:

      QUESTION 1:

      Let's say I have two objects (user and books) which map to two
      tables in a database.


      table BOOKS: USER_ID BOOK_ID

      with a relationship of 1 - M.

      (So the user object would have a collection of books as data member.)

      let's say I queried for a user with USER_ID = 1.

      would the PM also load all the Books associated with that user ?

      Question n'2:

      If I then fetched a particular user (USER_ID = 1)
      and I wanted to add a new book (BOOK_ID = 2)

      class user ...
      Collection books;

      books.add( book);

      would the PM load the entire Collection ?

      In general would the PM load the whole collection when we call any method on the collection? Or when would it ?


        • 1. Re: PM CMP/CMR behavior.
          gsarno Newbie

          can anyone please help me on this ??

          I think this is very important that EntityB designers
          should be aware of.


          • 2. Re: PM CMP/CMR behavior.
            Ivan O. Parra Novice


            Okay, I'm gonna help you out. I noticed that of the 10 postings you've done, 7 of them pertained to this scenario. I can understand the silence simply because many people working with CMP/CMR issues have spent alot of time answering this form of question.

            The quick/easy answer, BUY THE CMP DOCS!!!! You'll find all your answers there with appropriate examples. If the docs don't answer it, then try these forums.

            Your caching question, especially with distributed cacheing, will take a little longer. Buy/Read the clustering docs and learn about the different containers with cache invalidations. For Jboss3.2, you may risk transactional integrity with a distributed cache(unless you use optimistic locking.... I think). JB4.0 should solve this issue.

            Finally, if you can't find the answer here, find out yourself. Turn on the jboss debugging/trace for org.jboss.pm and see what queries the engine is creating. From those queries, you can see how your app reacts. You can then tune your containers and jboss.xmls to fit your personal need. Download the code and throw JBoss into the debugger. You'll be amazed how much better you'll understand your application and how it works with the appserver by throwing it into the debugger.

            Good Luck