List of elements in persistence.xml
<!-- turn off 2nd level caching (optional), values: NONE, ALL, DISABLE_SELECTIVE, ENABLE_SELECTIVE, --><shared-cache-mode>NONE</shared-cache-mode>
<!-- desired provider (optional), if not present, default provider will be used -->
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<!-- optional declaration of used datasource, if not specified, connection properties must be specified, otherwise will use specified datasrouce in container -->
<jta-data-source>jdbc/cbn</jta-data-source>
List of standard properties
Driver: <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/> URL: <property name="javax.persistence.jdbc.url"
value="jdbc:derby://localhost:1527/chapter02DB;create=true"/> User: <property name="javax.persistence.jdbc.user" value="APP"/> Password: <property name="javax.persistence.jdbc.password" value="APP"/>
Hibernate properties
Debug SQL: <property name="hibernate.show_sql" value="true"/>Schema generation (optional):
<!-- create the database schema automatically, values: create-drop, update -->
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
Dialect: <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
EclipseLink properties
Schema generation (optional):<!-- create the database schema automatically, values: create-tables, drop-and-create-tables -->
<property name="eclipselink.ddl-generation" value="create-tables"/>
Resources
- http://antoniogoncalves.org/2009/07/05/jpa-2-0-standard-properties-in-persistence-xml/
- Netbeans persistence.xml editor
No comments:
Post a Comment