Persistence.xml: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
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="signal-authority" transaction-type="JTA">
    <jta-data-source>java:jboss/datasources/samp-ds</jta-data-source>
    <class>com.ge.mp.topology.signalauthority.service.PersistedSignalAuthority</class>
    <class>com.ge.mp.topology.signalauthority.cache.DeviceStateCacheEntity</class>
    <class>com.ge.mp.topology.signalauthority.cache.TrainLocationCacheEntity</class>
    <class>com.ge.mp.topology.signalauthority.cache.TrainLockEntity</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>

Revision as of 19:22, 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="signal-authority" transaction-type="JTA">
    <jta-data-source>java:jboss/datasources/samp-ds</jta-data-source>
    <class>com.ge.mp.topology.signalauthority.service.PersistedSignalAuthority</class>
    <class>com.ge.mp.topology.signalauthority.cache.DeviceStateCacheEntity</class>
    <class>com.ge.mp.topology.signalauthority.cache.TrainLocationCacheEntity</class>
    <class>com.ge.mp.topology.signalauthority.cache.TrainLockEntity</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>