<?xml version="1.0" encoding="UTF-8"?>
<!--
    author: Jens Pelzetter
-->

<persistence 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_2_0.xsd"
             version="2.0">
    
    <persistence-unit name="LibreCCM" transaction-type="JTA">
        
        <!-- 
            Enforce JPA provider
            Not really necessary here because we don't use any Hibernate 
            specific features, but makes it easier to manage to database
            creation scripts.
        -->
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
            
        <jta-data-source>java:openejb/Resource/org-libreccm-ccm-core.testdb</jta-data-source>
        <properties>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.id.new_generator_mappings" value="true"/>
            <property name="hibernate.connection.autocommit" value="false" />
            
            <!-- 
                Properties for Hibernate Envers 
                We are using the ValidityAuditStrategy here because it is faster
                when querying data than the DefaultStrategy
            -->
            <property name="org.hibernate.envers.audit_strategy" 
                      value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
        </properties>
    </persistence-unit>
    
</persistence>