Search code examples
openjpa

How to replace '?' in openjpa query with a real parameters?


Is there any way to get replaced '?' in printed out by openjpa query?

TRACE openjpa.Query - Executing query: Query: org.apache.openjpa.kernel.QueryImpl@246923; TRACE openjpa.jdbc.SQL

SELECT * FROM TEST_TABLE WHERE ID = ? AND ROWNUM <= ? [params=(long) 111, (long) 5001]

I verified different combinations with following entries:

< entry key="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE, Query=TRACE, JDBC=TRACE"/>

and

< entry key="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true" />

but it seems to be not working, according to expectation.


Solution

  • Is there any way to get replaced '?' in printed out by openjpa query?

    I assume you want something like this : SELECT * FROM TEST_TABLE WHERE ID = 111 AND ROWNUM <= 5001? If so, no that is not possible. The reason for this is that OpenJPA will always favor setting parameters. Bummer if that isn't what you are looking for.