28.2. Using Alternate JPA Providers
Seam comes packaged and configured with Hibernate as the default JPA provider. To use a different JPA provider, you must configure it with Seam.
Note
This is a workaround — future versions of Seam will not require configuration changes to use alternative JPA providers, unless you add a custom persistence provider implementation.
There are two ways to tell Seam about your JPA provider. The first is to update your application's
components.xml
so that the generic PersistenceProvider
takes precedence over the Hibernate version. Simply add the following to the file:
<component name="org.jboss.seam.persistence.persistenceProvider" class="org.jboss.seam.persistence.PersistenceProvider" scope="stateless"> </component>
To take advantage of any of your JPA provider's non-standard features, you must write your own implementation of the
PersistenceProvider
. (You can use HibernatePersistenceProvider
as a starting point.) Tell Seam to use this PersistenceProvider
like so:
<component name="org.jboss.seam.persistence.persistenceProvider" class="org.your.package.YourPersistenceProvider"> </component>
Now, update
persistence.xml
with the correct provider class, and any properties required by your provider. Remember to package any required JAR
files with your application.