Skip to content

Instantly share code, notes, and snippets.

@aeberhardo
Forked from jesuino/persistence.xml
Created March 4, 2016 21:11
Show Gist options
  • Save aeberhardo/c073096a688b557aa094 to your computer and use it in GitHub Desktop.
Save aeberhardo/c073096a688b557aa094 to your computer and use it in GitHub Desktop.
Wildfly Datasource and JPA Descriptor (persistence.xml)
<?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="2.0" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primary">
<jta-data-source>java:jboss/datasources/PeopleDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.transaction.flush_before_completion" value="true"/>
</properties>
</persistence-unit>
</persistence>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<!-- The datasource is bound into JNDI at this location. We reference
this in META-INF/persistence.xml -->
<datasource jndi-name="java:jboss/datasources/PeopleDS"
pool-name="people-web" enabled="true"
use-java-context="true">
<connection-url>jdbc:h2:mem:people-web;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment