OpenJpa in Apache Geronimo 3.0

210 views Asked by At

I have a newbie question, so I hope you can help. Currently as ORM tool I am using OpenJPA 2.2.1 .

MY CUrrent persistence UNit:

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

    <persistence-unit name="FleaCircus" transaction-type="JTA">
        <description>Flea Circus</description>
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>FleaCircusOracleDS</jta-data-source>
        <class>de.carmedialab.db.entities.ApplicationItem</class>
        <class>de.carmedialab.db.entities.FleaResult</class>
        <class>de.carmedialab.db.entities.FleaResultType</class>
        <class>de.carmedialab.db.entities.ItemAttribute</class>
        <class>de.carmedialab.db.entities.ItemGroup</class>
        <class>de.carmedialab.db.entities.ItemType</class>
        <class>de.carmedialab.db.entities.ItemTypeAttribute</class>
        <class>de.carmedialab.db.entities.ItemTypeOperationAttribute</class>
        <class>de.carmedialab.db.entities.Operation</class>
        <class>de.carmedialab.db.entities.OperationAttribute</class>
        <class>de.carmedialab.db.entities.OperationType</class>
        <class>de.carmedialab.db.entities.Role</class>
        <class>de.carmedialab.db.entities.UserAccount</class>
        <class>de.carmedialab.db.entities.Measurement</class>
        <class>de.carmedialab.db.entities.MeasurementType</class>
        <class>de.carmedialab.db.entities.MeasurementAttribute</class>
        <class>de.carmedialab.db.entities.MeasurementAttributeType</class>
        <class>de.carmedialab.db.entities.Fleet</class>

        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" value="validate" />
            <property
                name="openjpa.Compatibility.CheckDatabaseForCascadePersistToDetachedEntity"
                value="true" />
              <!--<property name="openjpa.Log"
                value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />-->
        </properties>
    </persistence-unit>


    <persistence-unit name="FleaCircusLocal" transaction-type="RESOURCE_LOCAL">
        <description>Flea Circus</description>
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <non-jta-data-source>FleaCircusOracleDS</non-jta-data-source>
        <class>de.carmedialab.db.entities.ApplicationItem</class>
        <class>de.carmedialab.db.entities.FleaResult</class>
        <class>de.carmedialab.db.entities.FleaResultType</class>
        <class>de.carmedialab.db.entities.ItemAttribute</class>
        <class>de.carmedialab.db.entities.ItemGroup</class>
        <class>de.carmedialab.db.entities.ItemType</class>
        <class>de.carmedialab.db.entities.ItemTypeAttribute</class>
        <class>de.carmedialab.db.entities.ItemTypeOperationAttribute</class>
        <class>de.carmedialab.db.entities.Operation</class>
        <class>de.carmedialab.db.entities.OperationAttribute</class>
        <class>de.carmedialab.db.entities.OperationType</class>
        <class>de.carmedialab.db.entities.Role</class>
        <class>de.carmedialab.db.entities.UserAccount</class>
        <class>de.carmedialab.db.entities.Measurement</class>
        <class>de.carmedialab.db.entities.MeasurementType</class>
        <class>de.carmedialab.db.entities.MeasurementAttribute</class>
        <class>de.carmedialab.db.entities.MeasurementAttributeType</class>
        <class>de.carmedialab.db.entities.Fleet</class>

        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" value="validate" />
            <property
                name="openjpa.Compatibility.CheckDatabaseForCascadePersistToDetachedEntity"
                value="true" />
              <!--<property name="openjpa.Log"
                value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />-->
        </properties>

    </persistence-unit>

</persistence>

For the sake of simplicity, persistence-unit "FleaCircus" is what I use ( Container Managed Persistence ). FleaCircusLocal is another test pu I created , where I've created a sample stateless bean that basically starts a new transaction, persist an element and commit it. However it doesn't sinchronize immediatly and customer complains about it.

Is there any way to make OpenJPA makes whats in context immediatly visible to the DB or is it impossible due to the nature as OpenJPA/JPA was thought ?

For me it is not a big deal since data is visible inside the container ( Apache Geronimo ) however for the customer it is important since he wants to connet using 3rd party tool ( eg. SQL Developer to and see if data was inserted or not .)

0

There are 0 answers