FAQ has been edited by Patrick Linskey (May 21, 2007).

(View changes)

Content:

FAQ

General

What is OpenJPA?

OpenJPA is a 100% open-source implementation of the Java Persistence API (JPA), which is the persistence component for EJB in the Java EE 5 specification.

What is the history of OpenJPA?

OpenJPA has its roots in the popular Kodo product, which was created by SolarMetric, Inc. in 2001. BEA Systems, Inc. purchased SolarMetric in November of 2005, and soon thereafter announced that they would be donating the bulk of the code to the Apache Software Foundation. OpenJPA is the result of that donation.

What is the current relationship between Kodo and OpenJPA?

Version 4.1 of Kodo will be based on the OpenJPA code base.

What is the current status of the project?

OpenJPA is a top-level project at the Apache Software Foundation.

Where can I download OpenJPA?

Look at the Downloads page.

Does OpenJPA work with my application server or container?

See Integration.

How can I contribute to OpenJPA?

Check out the Get Involved page.

Technical

How do I see the SQL that OpenJPA is executing?

OpenJPA provides configurable channel-based logging, as described in the chapter on Logging. The simplest example of enabling verbose logging is by using the following property in your persistence.xml file:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="example-logging" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
        </properties>
    </persistence-unit>
</persistence>


How do I enable connection pooling in OpenJPA?

OpenJPA doesn't include any built-in connection pool, but you can use any third-party connection pool that is configurable via the JDBC DataSource API (which most are). The following persistence.xml example shows how to use OpenJPA with a Apache Derby database and the Apache DBCP connection pool:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="example-derby" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="openjpa.ConnectionURL" 
                value="DriverClassName=org.apache.derby.jdbc.ClientDriver,
                  Url="" class="code-comment">//localhost:1527/database, 
                  MaxActive=100, 
                  MaxWait=10000, 
                  TestOnBorrow=true, 
                  Username=user, 
                  Password=secret"/>
            <property name="openjpa.ConnectionDriverName" 
                value="org.apache.commons.dbcp.BasicDataSource"/>
        </properties>
    </persistence-unit>
</persistence>

See the documentation on Using a Third-Party DataSource for further details.

Reply via email to