Persistence.xml: Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
=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>