<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_1_0.xsd" version="1.0"> <persistence-unit name="jta" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>jdbc/myderby</jta-data-source> </persistence-unit> <persistence-unit name="hibernate-resourceLocal" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <!-- Connection properties --> <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.ClientDriver" /> <property name="hibernate.connection.url" value="jdbc:derby://localhost:1527/c:\derbydb\mydb" /> <property name="hibernate.connection.username" value="APP" /> <property name="hibernate.connection.password" value="APP" /> <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" /> <!-- create-drop, create --> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.connection.autocommit" value="true" /> </properties> </persistence-unit> <persistence-unit name="eclipseLink-resourceLocal" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>com.test.entity.User</class> <properties> <!-- Connection properties --> <property name="eclipselink.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver" /> <property name="eclipselink.jdbc.url" value="jdbc:derby://localhost:1527/c:\derbydb\mydb" /> <property name="eclipselink.jdbc.user" value="APP" /> <property name="eclipselink.jdbc.password" value="APP" /> <property name="eclipselink.target-database" value="Derby" /> <!-- drop-and-create-tables --> <property name="eclipselink.ddl-generation" value="create-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.logging.parameters" value="true" /> <property name="eclipselink.logging.level" value="FINE" /> </properties> </persistence-unit> <persistence-unit name="openjpa-resourceLocal" transaction-type="RESOURCE_LOCAL"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <class>com.test.entity.User</class> <properties> <!-- Connection properties --> <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.ClientDriver" /> <property name="openjpa.ConnectionURL" value="jdbc:derby://localhost:1527/c:\derbydb\mydb" /> <property name="openjpa.ConnectionUserName" value="APP" /> <property name="openjpa.ConnectionPassword" value="APP" /> <property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> <property name="openjpa.jdbc.DBDictionary" value="derby" /> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" /> </properties> </persistence-unit> </persistence>
Thursday, 13 September 2012
Persistence.xml cheat sheet for Hibernate, EclipseLink and OpenJPA
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment