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

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 
                                 http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">

    <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:jboss/datasources/LibreCCM</jta-data-source>

        <!--<jta-data-source>java:/comp/env/jdbc/libreccm/db</jta-data-source>-->

        <jar-file>lib/ccm-core-7.0.0-SNAPSHOT.jar</jar-file>
        <jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file>
        <jar-file>lib/ccm-shortcuts-7.0.0-SNAPSHOT.jar</jar-file>


        <properties>
            <!-- Properties for Hibernate -->
            <property name="hibernate.hbm2ddl.auto" value="validate" />
            <property name="hibernate.connection.autocommit" value="false" />
            <property name="hibernate.id.new_generator_mappings" value="true" />
            <property name="wildfly.jpa.hibernate.search.module" 
                      value="org.hibernate.search.orm:main" />
            
            <!--<property name="hibernate.show_sql" value="true" />
            <property name="format_sql" value="true" />
            <property name="use_sql_comments" value="true" />-->

            <!-- 
                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>
