3 Replies Latest reply on Aug 28, 2001 6:40 AM by juergenheidak

    JBoss deleting database entries ?

    juergenheidak

      Configuration: JBoss (2.2.2, 2.4) on Linux (Suse 7.2) and Windows 2000, Oracle 8.1.5

      We've got a multiple clients running against JBoss, each of them accessing two entity beans (customer, contacts; one to many relationship) through a stateless session bean. The entity beans persistence is container managed.
      To be able to do some kind of performance testing we filled 1000 customers and 100000 contacts in the underlying sql tables (each customer has 100 dependent contacts). All clients do the same thing, creating one additional customer and 100 contacts and retrieve them back. One test chooses one of the previously created 1000 customers and retrieves all its data. This test is read-only but after running for a while step by step all of the initially inserted contacts are gone. (no customers are deleted).

      I know this sounds like an error in the code (at least this was my first thought) but there are some reason against this theory:

      - I checked the code several times

      - all unit tests are succesful

      - References to the entity beans are never passed directly to the client, they are always accessed through the session bean. The session bean itself makes no call to the remove method.

      - The same test scenario works fine under three other appserver (orion, inprise, bea).

      I' ve checked the sql statements executed by jboss against the database and there are really statements deleting some of the initial contacts.

      I dont think that this is a bug because such a big one would have been experienced by someone long ago. But on the other hand I have nothing left to check, I can find any error in my code and / or configuration.

      Any idea ?

        • 1. Re: JBoss deleting database entries ?
          davidjencks

          I always find checking my code many times is no assurance that I haven't put in lots of defects ;-)

          What delete statements are being executed? what is happening when they are being executed? (look hard at the log).

          I have sometimes resorted to filtering the log through awk and sorting the results by thread to figure out what is going on. (see the log4j conf. file for a helpful log format).

          Another possible way of investigating is to put something like this in JDBCDeleteCommand (I think that's the one)

          log.warn("Delete called: ", new Exception("here's the stack trace"));

          can you come up with a small self contained example?

          • 2. Re: JBoss deleting database entries ?
            juergenheidak

            It took some time to fix it, of course it was an error in the code :-)).

            Modelling the one-to-many relationship between a customer and its contact we used a hashtable in each customer bean to save the references to its contact. This hashtable has to be cleared during ejbPassivate to ensure that a bean reused from the instance pool dont references contacts from its "previous" life, this was the problem.

            The error was so hard to reproduce because an entity bean used in one special test has to be reused in annother special test.

            I hope i did not cause you too much work, if so sorry.

            • 3. Re: JBoss deleting database entries ?
              juergenheidak

              I dont know if my previous post is lost, so to be sure i post it again.
              The error was in the code, a hashtable with references to entity beans has not been cleared during ejbPassivate.

              Thanks for your help