SQL - query arguments debugging
dzakharov.dmitri.zakharov.gmail.com May 15, 2009 7:02 PMHello,
Does anybody know if it's possible to configure SQL debugging in Seam 2.1.1.GA/JBoss 5.0.1.GA to be able to see the final SQL executed by Hibernate? What I mean by the final is including the values of arguments for the query.
I have a strange problem in the CRUD prototype project that has just been generated from existing DB2/AS400 database as EAR project and I did not modify anything yet. The problem seams to be random (at least I was not able yet to identify the exact pattern of the error cause). When I type in one of search parameters in the standard generated List view page and Search
I get a huge exception stack, which seems to be starting with the following:
2009-05-15 12:22:43,260 WARN [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8080-2) SQL Error: -171, SQLState: 42815 2009-05-15 12:22:43,260 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8080-2) [SQL0171] Argument *N of function CONCAT not valid.
The output above follows the following query that I see in server.log file:
2009-05-15 12:22:43,245 INFO [STDOUT] (http-127.0.0.1-8080-2) Hibernate: select claim0_.CLAIM_ID as CLAIM1_1_, claim0_.ADJUSTMENT_NUMBER as ADJUSTMENT2_1_, claim0_.STATUS_ID as STATUS22_1_, claim0_.CREATE_APPLICATION as CREATE3_1_, claim0_.CREATE_DATE as CREATE4_1_, claim0_.CREATE_USER as CREATE5_1_, claim0_.DOCUMENT_NUMBER as DOCUMENT6_1_, claim0_.DUTY_AMOUNT as DUTY7_1_, claim0_.DUTY_PAID_DATE as DUTY8_1_, claim0_.EXCISE_DUTY_AMOUNT as EXCISE9_1_, claim0_.EXCISE_TAX_AMOUNT as EXCISE10_1_, claim0_.EXPORT_DATE as EXPORT11_1_, claim0_.EXPORTER_ID as EXPORTER23_1_, claim0_.GST_AMOUNT as GST12_1_, claim0_.IMPORTER_CITY as IMPORTER13_1_, claim0_.IMPORTER_COUNTRY as IMPORTER14_1_, claim0_.IMPORTER_NAME as IMPORTER15_1_, claim0_.IMPORTER_POSTAL_CODE as IMPORTER16_1_, claim0_.IMPORTER_PROVINCE as IMPORTER17_1_, claim0_.IMPORTER_STREET as IMPORTER18_1_, claim0_.PST_AMOUNT as PST19_1_, claim0_.SHIPMENT_NUMBER as SHIPMENT20_1_, claim0_.TOTAL_AMOUNT as TOTAL21_1_, claim0_.TRANSMISSION_ID as TRANSMI24_1_ from UNITED.CREDITS_DB.CLAIM claim0_ where lower(claim0_.IMPORTER_NAME) like lower(?)||'%' order by claim0_.DOCUMENT_NUMBER asc fetch first 26 rows only
And concatanation is happening in the following part:
where lower(claim0_.IMPORTER_NAME) like lower(?)||'%'
If I click Reset
button and search again by Importer
Name value, it might work OK. Than if I click one of the sort links in the result table header, type it search value and click Search
again it might fails.
So I would like to see what argument value is in the final SQL query. And what values causes this error:
[SQL0171] Argument *N of function CONCAT not valid
Any leads are really appreciated.
Thank you.