org.springframework.orm.jpa.vendor
Class HibernateJpaVendorAdapter

java.lang.Object
  extended by org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter
      extended by org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
All Implemented Interfaces:
JpaVendorAdapter

public class HibernateJpaVendorAdapter
extends AbstractJpaVendorAdapter

JpaVendorAdapter implementation for Hibernate EntityManager. Developed and tested against Hibernate 3.3.

Exposes Hibernate's persistence provider and EntityManager extension interface, and supports AbstractJpaVendorAdapter's common configuration settings.

Since:
2.0
Author:
Juergen Hoeller, Rod Johnson
See Also:
org.hibernate.ejb.HibernatePersistence, org.hibernate.ejb.HibernateEntityManager

Field Summary
private  JpaDialect jpaDialect
           
private  PersistenceProvider persistenceProvider
           
 
Constructor Summary
HibernateJpaVendorAdapter()
           
 
Method Summary
protected  java.lang.Class determineDatabaseDialectClass(Database database)
          Determine the Hibernate database dialect class for the given target database.
 java.lang.Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface()
          Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.
 java.lang.Class<? extends EntityManager> getEntityManagerInterface()
          Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement.
 JpaDialect getJpaDialect()
          Return the vendor-specific JpaDialect implementation for this provider, or null if there is none.
 java.util.Map<java.lang.String,java.lang.Object> getJpaPropertyMap()
          Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.
 PersistenceProvider getPersistenceProvider()
          Return the vendor-specific persistence provider.
 java.lang.String getPersistenceProviderRootPackage()
          Return the name of the persistence provider's root package (e.g.
 
Methods inherited from class org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter
getDatabase, getDatabasePlatform, isGenerateDdl, isShowSql, postProcessEntityManagerFactory, setDatabase, setDatabasePlatform, setGenerateDdl, setShowSql
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

persistenceProvider

private final PersistenceProvider persistenceProvider

jpaDialect

private final JpaDialect jpaDialect
Constructor Detail

HibernateJpaVendorAdapter

public HibernateJpaVendorAdapter()
Method Detail

getPersistenceProvider

public PersistenceProvider getPersistenceProvider()
Description copied from interface: JpaVendorAdapter
Return the vendor-specific persistence provider.


getPersistenceProviderRootPackage

public java.lang.String getPersistenceProviderRootPackage()
Description copied from interface: JpaVendorAdapter
Return the name of the persistence provider's root package (e.g. "oracle.toplink.essentials"). Will be used for excluding provider classes from temporary class overriding.

Specified by:
getPersistenceProviderRootPackage in interface JpaVendorAdapter
Overrides:
getPersistenceProviderRootPackage in class AbstractJpaVendorAdapter

getJpaPropertyMap

public java.util.Map<java.lang.String,java.lang.Object> getJpaPropertyMap()
Description copied from interface: JpaVendorAdapter
Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.

Note that there might be further JPA properties defined on the EntityManagerFactory bean, which might potentially override individual JPA property values specified here.

Specified by:
getJpaPropertyMap in interface JpaVendorAdapter
Overrides:
getJpaPropertyMap in class AbstractJpaVendorAdapter
Returns:
a Map of JPA properties, as as accepted by the standard JPA bootstrap facilities, or null or an empty Map if there are no such properties to expose
See Also:
javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map), javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)

determineDatabaseDialectClass

protected java.lang.Class determineDatabaseDialectClass(Database database)
Determine the Hibernate database dialect class for the given target database.

Parameters:
database - the target database
Returns:
the Hibernate database dialect class, or null if none found

getJpaDialect

public JpaDialect getJpaDialect()
Description copied from interface: JpaVendorAdapter
Return the vendor-specific JpaDialect implementation for this provider, or null if there is none.

Specified by:
getJpaDialect in interface JpaVendorAdapter
Overrides:
getJpaDialect in class AbstractJpaVendorAdapter

getEntityManagerFactoryInterface

public java.lang.Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface()
Description copied from interface: JpaVendorAdapter
Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.

If the provider does not offer any EntityManagerFactory extensions, the adapter should simply return the standard javax.persistence.EntityManagerFactory class here.

Specified by:
getEntityManagerFactoryInterface in interface JpaVendorAdapter
Overrides:
getEntityManagerFactoryInterface in class AbstractJpaVendorAdapter

getEntityManagerInterface

public java.lang.Class<? extends EntityManager> getEntityManagerInterface()
Description copied from interface: JpaVendorAdapter
Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement.

If the provider does not offer any EntityManager extensions, the adapter should simply return the standard javax.persistence.EntityManager class here.

Specified by:
getEntityManagerInterface in interface JpaVendorAdapter
Overrides:
getEntityManagerInterface in class AbstractJpaVendorAdapter