Skip to content

Instantly share code, notes, and snippets.

@aelkz
Forked from aziz781/gist:1336488
Created October 31, 2017 16:41
Show Gist options
  • Save aelkz/2889d4d97784eeb8f3604ac7d3e62059 to your computer and use it in GitHub Desktop.
Save aelkz/2889d4d97784eeb8f3604ac7d3e62059 to your computer and use it in GitHub Desktop.
Java sample persistence.xml with JNDI JTA Data source and Hibernate configuration
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="MyAppUnit" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/myAppDS</jta-data-source>
<!-- Package: uk.co.example.domain -->
<class>uk.co.example.domain.InboundData</class>
<class>uk.co.example.domain.InboundDataSource</class>
<class>uk.co.example.domain.Dealer</class>
<!-- Package: uk.co.example.domain.stg -->
<class>uk.co.example.domain.stg.AgreementEvent</class>
<!-- Hibernate properties -->
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.connection.charSet" value="UTF-8"/>
<property name="hibernate.validator.apply_to_ddl" value="false"/>
<property name="hibernate.validator.autoregister_listeners" value="false"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
</persistence>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment