List of elements in persistence.xml
<shared-cache-mode>NONE</shared-cache-mode>
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<jta-data-source>jdbc/ds</jta-data-source>
Code language: HTML, XML (xml)
These elements can be overridden with the following properties, if a map is passed to EntityManagerFactory:
javax.persistence.provider
to define the provider class used
javax.persistence.transactionType
to define the transaction type used (either JTA or RESOURCE_LOCAL)
javax.persistence.jtaDataSource
to define the JTA datasource name in JNDI
javax.persistence.nonJtaDataSource
to define the non JTA datasource name in JNDI
javax.persistence.lock.timeout
– pessimistic lock timeout in milliseconds (Integer or String)
javax.persistence.query.timeout
– query timeout in milliseconds (Integer or String)
javax.persistence.sharedCache.mode
corresponds to the share-cache-mode
element defined in Section 2.2.1, “Packaging”
javax.persistence.validation.mode
corresponds to the validation-mode
element defined in Section 2.2.1, “Packaging”
See Hibernate 3.5 reference
List of standard properties
Driver:
<property name="javax.persistence.jdbc.driver"
value="org.apache.derby.jdbc.ClientDriver"/>
Code language: HTML, XML (xml)
URL:
<property name="javax.persistence.jdbc.url"
value="jdbc:derby://localhost:1527/chapter02DB;create=true"/>
Code language: HTML, XML (xml)
User:
<property name="javax.persistence.jdbc.user" value="APP"/>
Code language: HTML, XML (xml)
Password:
<property name="javax.persistence.jdbc.password" value="APP"/>
Code language: HTML, XML (xml)
Hibernate properties
Debug SQL:
<property name="hibernate.show_sql" value="true"/>
Code language: HTML, XML (xml)
Schema generation (optional):
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
Code language: HTML, XML (xml)
Dialect:
<property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect" />
Code language: HTML, XML (xml)
EclipseLink properties
Schema generation (optional):
<property name="eclipselink.ddl-generation"
value="create-tables"/>
Code language: HTML, XML (xml)
Resources