[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3130) Facility to get the SQLs of prepared statements (same as with show_sql=true) to Statistics

Timo Rantalaiho (JIRA) noreply at atlassian.com
Mon Feb 25 11:30:35 EST 2008


Facility to get the SQLs of prepared statements (same as with show_sql=true) to Statistics
------------------------------------------------------------------------------------------

                 Key: HHH-3130
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3130
             Project: Hibernate3
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.2.6
            Reporter: Timo Rantalaiho
         Attachments: sqls-to-statistics.patch

Hello! It would be excellent to be able to get the SQL produced by Hibernate operations via the Statistics interface. 

For example, we have a complex domain and complex queries and have hit an n-selects problem a couple of times when using lazy loading. By being able to assert the number of queries (which you can already get with Statistics.getPrepareStatementCount()) it's possible to control this automatically with developer tests, but we can make our test assertions a lot better by showing the actual SQL statements in the error message. That way it's typically easy to see from the error message which properties you need to add to the ones fetched in the query.

Currently, you have to resort to setting show_sql = true in the configuration, which is clumsy to do in developer tests. It seems that in AbstractBatcher it is easy enough to pass the same information to Statistics, as demonstrated in the attached patch.

The patch is done against the current trunk (revision 14355, Mon Feb 25 2008).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list