title: How do I debug SQL query through JBOSS logs?
body: <p>I am using JPA hibernate, with postgres. Problem arises on trying to run getResultList() on javax.persistence.Query. The query is small about 10 lines but with joins and around 80 columns in each of the two tables queried it balloons to around 200 lines of JBOSS logs. Something like below.</p>
  
  <pre><code>15:47:05,908 INFO  [stdout] (Thread-11 (HornetQ-client-global-threads-507424984)) Hibernate: 
  15:47:05,910 INFO  [stdout] (Thread-11 (HornetQ-client-global-threads-507424984))     select
  15:47:05,911 INFO  [stdout] (Thread-11 (HornetQ-client-global-threads-507424984))         tablename0_.some_field_name as auto_genrated_field_name,
  ....
  15:47:06,255 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-11 (HornetQ-client-global-threads-507424984)) SQL Error: 0, SQLState: 42883
  15:47:06,256 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-11 (HornetQ-client-global-threads-507424984)) ERROR: operator does not exist: character varying ~~ integer
  Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
  Position: 7236
  </code></pre>
  
  <p>As seen, the log does not tell me exactly which field name the type conversion is having the problem, but only the character position which it thinks is wrong. As per the indentation and the way hibernate formats my query I cannot be sure which variable it is referring to. I actually tried putting this exact query log onto an editor and then take me to that character position, but I am not sure if I am looking at the right place. I have also looked in Eclipse debugger and the parameter types match, when creating the query.</p>
  
  <p>Is there any switch in JBOSS logs, or configuration that would tell me exactly which field I am getting wrong.</p>