2 Replies Latest reply on Mar 12, 2004 12:42 PM by mkyaj

    Verifying the read-ahead methods

    mkyaj

      Hi,

      I am using JBOSS3.2.2 and postgreSQL7.3.1 as database.

      I believe if i dont use any read ahead method then the findAll() method will suffer from n+1 problem. Means if i have n records for an EntityA.
      So when i call findAll() which returns EntityA, JBOSS will only read the Primary keys of all the records. When we access any business method on the entity it will load the total entity.

      When i use on-find strategy it will load all the entities in single query. But how can i verify that? How can i check how many queries have been fired? Can i do that using triggers in database means incrementing some field whenever there is a SELECT? But i read somewhere that SELECT cannot fire any triggers.

      Please suggest me some way to verify that.

      Thanks,
      Murali.

        • 1. Re: Verifying the read-ahead methods

          Enable DEBUG level logging on org.jboss.ejb.plugin.cmp, and (optionally) direct that to a separate log file (such as db.log). This gives you a good idea what SQL is being executed on the DB.

          • 2. Re: Verifying the read-ahead methods
            mkyaj

            Hi Juha,

            Thank you very much for your help.
            In the log4j.xml i already have




            so i changed that to



            and i am getting all the database executed queries in detail.
            I wasted 3 days in just trying to figure out this using triggers.

            Thanks once again

            Murali.