Persistence.xml: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 13: Line 13:
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   version="2.0">
   version="2.0">
   <persistence-unit name="my-application" transaction-type="JTA">
   <persistence-unit name="my-application" transaction-type="JTA">
     <jta-data-source>java:jboss/datasources/mysql-ds</jta-data-source>
     <jta-data-source>java:jboss/datasources/mysql-ds</jta-data-source>
     <class>io.novaordis.example.MyEntity</class>
     <class>io.novaordis.example.MyEntity</class>
     <exclude-unlisted-classes>true</exclude-unlisted-classes>
     <exclude-unlisted-classes>true</exclude-unlisted-classes>


     <shared-cache-mode>ALL</shared-cache-mode>
     <shared-cache-mode>ALL</shared-cache-mode>
     <properties>
     <properties>
       <property name="hibernate.default_batch_fetch_size" value="500" />
       <property name="hibernate.default_batch_fetch_size" value="500" />
Line 24: Line 29:
       <property name="hibernate.cache.use_query_cache" value="true" />
       <property name="hibernate.cache.use_query_cache" value="true" />
     </properties>
     </properties>
   </persistence-unit>
   </persistence-unit>
</persistence>
</persistence>
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 19:24, 3 August 2017

Internal

Overview

Example

<?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"
  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="my-application" transaction-type="JTA">

    <jta-data-source>java:jboss/datasources/mysql-ds</jta-data-source>

    <class>io.novaordis.example.MyEntity</class>

    <exclude-unlisted-classes>true</exclude-unlisted-classes>

    <shared-cache-mode>ALL</shared-cache-mode>

    <properties>
      <property name="hibernate.default_batch_fetch_size" value="500" />
      <property name="hibernate.cache.use_second_level_cache" value="true" />
      <property name="hibernate.cache.use_query_cache" value="true" />
    </properties>

  </persistence-unit>
</persistence>