Show Sql/Jpql

#1

Is there a way to show the executed Sql/Jpql in the console?

#2

You can set the log element in ObjectDB configuration to write logging also to the console:

    <log path="$objectdb/log/" max="8mb" stdout="true" stderr="false" />

When stdout is set to true, all the logging information is written to the console, in addition to being written to the log file. Currently you cannot send only selective information from the log to the console.

To write query execution to the log, add the following logger element to the configuration:

    <logger name="query.manager" level="debug" />
ObjectDB Support
#3

I know that, but is there a possibility to see it in Sql/Jpql style not xml. I can only see select statements, but I also want to see insert, update and delete

#4

It may be a good idea to log queries as strings in TRACE logging level.

ObjectDB (unlike ORM JPA implementation) does not use queries to implement Insert, Update and Delete operations (except delete/update queries). You may log these operations by setting a JPA lifecycle listener or callback.

ObjectDB Support
#5

Build 2.4.7_01 adds simple text logging of query execution.

It could be enabled by setting the following logger in the configuration file:

    <logger name="query.manager" level="trace" />
  </general>

This will generate logging lines, such as:

Query "SELECT e FROM MyEntity e" => 100 results in 1 milliseconds.
ObjectDB Support

Reply