OpenJPA Configuration in WAS 7.0.0.25

619 Views Asked by At

I am looking at the performance optimization of Open JPA for my WAS 7.0.0.25 server. I enabled OpenJPA trace from WAS console to understand what properties are taken for caching.

There is no openjpa.= type entry in my persistance.xml. But I can see entries in the trace.log as below:

openjpa.IgnoreChanges: false
openjpa.FlushBeforeQueries: 0
openjpa.ConnectionRetainMode: 0

But i could not find the configuration that sets these properties so that I can play around with them.

Can anyone guide me where I can find these values coming from the Open JPA provided by WAS 7?

2

There are 2 best solutions below

3
On BEST ANSWER

Accordingly to the documentation you should add this line to your persistence.xml:

<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/> 

http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_logging_openjpa.html


ADDED

If you add those keys in your persistence.xml, probably the default values will be overridden.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="...">

        <properties>
            <property name="openjpa.jdbc.DBDictionary" value="oracle" />
            <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
            <property name="openjpa.AutoDetach" value="close" />
            <property name="openjpa.DetachState" value="loaded" />
            <property name="openjpa.DataCache" value="false" />
            <property name="openjpa.Optimistic" value="true" />
            <property name="openjpa.Multithreaded" value="true" />
            <property name="openjpa.TransactionMode" value="managed" />
            <property name="openjpa.ConnectionFactoryMode" value="managed" />
            <property name="openjpa.NontransactionalRead" value="true" />
            <property name="openjpa.RestoreState" value="all" />
            <property name="openjpa.ManagedRuntime" value="auto" />
        </properties>
    </persistence-unit>


</persistence>
3
On

Xhings -

If you are looking for default configuration values, you should start by looking at the user manual. That beings said, the only property that I would recommend (from a performance point of view) to change is openjpa.ConnectionRetainMode. Setting that property to always has shown some performance impact.