0

I am trying to log the return values from HQL and I followed the following instructions: https://www.mkyong.com/hibernate/how-to-display-hibernate-sql-parameter-values-solution/

I was able to use 1.1 to see the return values on my eclipse. However, when i use mvn build and run it i get:

INFO: HHH000046: Connection properties: {user=root, password=****}
Failed to create sessionFactory object.java.lang.NullPointerException
[WARNING]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError
        at foo.bar.Main.main(Main.java:36)
        ... 6 more
Caused by: java.lang.NullPointerException
        at com.p6spy.engine.spy.P6SpyDriverCore.connect(P6SpyDriverCore.java:371)..

i tried to use 1.3 but see : ERROR: Unable to find a driver that accepts jdbc:p6spy:mysql://localhost:3306/testdb

i used deregistered=true but that didnt work.

Now, if i use the version below it is fine:

<dependency>
           <groupId>p6spy</groupId>
            <artifactId>p6spy</artifactId>
             <version>2.1.4</version> 
             </dependency> 

However, when i run my program i see: 1491427383465|37|statement|connection 0|select person0_.personid as ... 1491427383494|0|statement|connection 0|select items0...

How do i get the returned values? i am lost here....

  • I think p6spy not show the returned values of the SQL. The idea of p6spy is log the SQLs sent to the database: `select items0...`. – Dherik Apr 06 '17 at 02:57
  • Could you include the contents of spy.properties in your question? – quintonm Apr 07 '17 at 18:10

1 Answers1

0

The default setting for P6Spy is to not include the returned values. You can enable this by adding or updating the following lines in spy.properties.

#list of categories to exclude: error, info, batch, debug, statement,
#commit, rollback and result are valid values
# (default is info,debug,result,resultset,batch)
excludecategories=info,debug,result,batch

The full documentation for spy.properties as well as other ways to provide config are at http://p6spy.readthedocs.io/en/latest/configandusage.html.

quintonm
  • 838
  • 1
  • 7
  • 20