persistence.xml 2.45 KB
<persistence version="2.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_2_0.xsd">
	<persistence-unit name="swXercisePU" transaction-type="JTA">
		<jta-data-source>java:jboss/datasources/swXerciseDS</jta-data-source>
		<properties>
			<!-- property name="hibernate.hbm2ddl.auto" value="create-drop" / -->
			<property name="hibernate.hbm2ddl.auto" value="update" />
		</properties>
	</persistence-unit>

    <persistence-unit name="swXerciseTestPU" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <!-- Property for WildFly to ignore this -->
            <property name="jboss.as.jpa.managed" value="false" />
            <!-- Properties for Hibernate -->
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://${swxercise.test.host}:${swxercise.test.port}/${swxercise.test.schema}" />
            <property name="javax.persistence.jdbc.user" value="${swxercise.test.user}" />
            <property name="javax.persistence.jdbc.password" value="${swxercise.test.password}" />
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.format_sql" value="false" />
            <!--<property name="hibernate.hbm2ddl.auto" value="create-drop" / -->
            <property name="hibernate.connection.useUnicode" value="true" />
            <property name="hibernate.connection.characterEncoding" value="UTF-8" />
            <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
            <property name="hibernate.c3p0.min_size" value="2" />
            <property name="hibernate.c3p0.max_size" value="100" />
            <property name="hibernate.c3p0.timeout" value="10" />
            <property name="hibernate.c3p0.max_statements" value="100" />
            <property name="hibernate.c3p0.idle_test_period" value="30" />
            <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
            <property name="hibernate.ejb.entitymanager_factory_name" value="swXerciseTestPU" />
        </properties>
    </persistence-unit>
</persistence>