1 Reply Latest reply on Feb 9, 2007 4:00 PM by Andrew Rubinger

    How to get Query time??

    Alex Levine Newbie

      I'm trying to write some code to evaluate query performance in my ejb3 code. I was wondering if there was some way to get the actual time that it takes jboss to load/store /update stuff in the database. Doint this following will NOT work:

      long t1 = System.currentTimeMillis();
      em.merge(myEJB);
      long updateTime = System.currentTimeMillis() - t1;
      


      This does not work because if this is happening in a transaction the actually storing of the stuff is not done until the end of the transaction, so measuring the time it takes em.merge to complete is not a valid estimate of the actual update time.

      Is there any way to tap into some low level jboss API or use interceptors to get a more accurate measure of the database update time??