Persistence.xml: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * WildFly Deployment Descriptors =Overview=")
 
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[WildFly_Deployment_Descriptors#Standard_JEE_Deployment_Descriptors|WildFly Deployment Descriptors]]
* [[WildFly_Deployment_Descriptors#Standard_JEE_Deployment_Descriptors|WildFly Deployment Descriptors]]
* [[JPA Configuration#Overview|JPA Configuration]]


=Overview=
=Overview=
=Example=
<syntaxhighlight lang='xml'>
<?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>
</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>