Using the example DS in JBOSS for testing purposes
Here is a an example persistence.xml
which could be used to test database operations, if you do not want to work against a real database. For example while running an arquillian test case.
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" 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"> <persistence-unit name="myPesistanceUnit" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> <property name="hibernate.archive.autodetection" value="class"/> <property name="hibernate.format_sql" value="true"/> </properties> </persistence-unit> </persistence> |
The configured datasource java:jboss/datasources/ExampleDS
should already be configured in the standalone.xml
of the JBOSS (EAP6 or AS 7).