Part I Development Tasks and Tools
1. Setting Up a Development Environment
Part II Developing Applications and Application Components
6. Using the Java Persistence API
Additional Database Properties
Primary Key Generation Defaults
Restrictions and Optimizations
Using @OrderBy with a Shared Session Cache
Using BLOB or CLOB Types with the Inet Oraxo JDBC Driver
Named Native Queries and JDBC Queries
7. Developing Web Applications
8. Using Enterprise JavaBeans Technology
9. Using Container-Managed Persistence
12. Developing Lifecycle Listeners
13. Developing OSGi-enabled Java EE Applications
Part III Using Services and APIs
14. Using the JDBC API for Database Access
15. Using the Transaction Service
16. Using the Java Naming and Directory Interface
Note - The previous sections in this chapter apply only to the default persistence provider. If you change the provider for a module or application, the provider-specific database properties, query hints, and schema generation features described in this chapter do not apply.
You can change the persistence provider for an application in the manner described in the Java Persistence API Specification.
First, install the provider. Copy the provider JAR files to the domain-dir/lib directory, and restart the GlassFish Server. For more information about the domain-dir/lib directory, see Using the Common Class Loader. The new persistence provider is now available to all modules and applications deployed on servers that share the same configuration. However, the default provider remains the same.
In your persistence unit, specify the provider and any properties the provider requires in the persistence.xml file. For example:
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name ="em3"> <provider>com.company22.persistence.PersistenceProviderImpl</provider> <properties> <property name="company22.database.name" value="MyDB"/> </properties> </persistence-unit> </persistence>
To migrate from Oracle TopLink to EclipseLink, see Migrating from Oracle TopLink to EclipseLink.