Spring Framework

org.springframework.orm.jpa.vendor
Class AbstractJpaVendorAdapter

java.lang.Object
  extended by org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter
All Implemented Interfaces:
JpaVendorAdapter
Direct Known Subclasses:
EclipseLinkJpaVendorAdapter, HibernateJpaVendorAdapter, OpenJpaVendorAdapter, TopLinkJpaVendorAdapter

public abstract class AbstractJpaVendorAdapter
extends java.lang.Object
implements JpaVendorAdapter

Abstract JpaVendorAdapter implementation that defines common properties, to be translated into vendor-specific JPA properties by concrete subclasses.

Since:
2.0
Author:
Juergen Hoeller, Rod Johnson

Constructor Summary
AbstractJpaVendorAdapter()
           
 
Method Summary
protected  Database getDatabase()
          Return the target database to operate on.
protected  java.lang.String getDatabasePlatform()
          Return the name of the target database to operate on.
 java.lang.Class<? extends javax.persistence.EntityManagerFactory> getEntityManagerFactoryInterface()
          Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.
 java.lang.Class<? extends javax.persistence.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,?> getJpaPropertyMap()
          Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.
 java.lang.String getPersistenceProviderRootPackage()
          Return the name of the persistence provider's root package (e.g.
protected  boolean isGenerateDdl()
          Return whether to generate DDL after the EntityManagerFactory has been initialized creating/updating all relevant tables.
protected  boolean isShowSql()
          Return whether to show SQL in the log (or in the console).
 void postProcessEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
          Post-process the EntityManagerFactory after it has been initialized.
 void setDatabase(Database database)
          Specify the target database to operate on, as a value of the Database enum: DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
 void setDatabasePlatform(java.lang.String databasePlatform)
          Specify the name of the target database to operate on.
 void setGenerateDdl(boolean generateDdl)
          Set whether to generate DDL after the EntityManagerFactory has been initialized, creating/updating all relevant tables.
 void setShowSql(boolean showSql)
          Set whether to show SQL in the log (or in the console).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.orm.jpa.JpaVendorAdapter
getPersistenceProvider
 

Constructor Detail

AbstractJpaVendorAdapter

public AbstractJpaVendorAdapter()
Method Detail

setDatabase

public void setDatabase(Database database)
Specify the target database to operate on, as a value of the Database enum: DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE


getDatabase

protected Database getDatabase()
Return the target database to operate on.


setDatabasePlatform

public void setDatabasePlatform(java.lang.String databasePlatform)
Specify the name of the target database to operate on. The supported values are vendor-dependent platform identifiers.


getDatabasePlatform

protected java.lang.String getDatabasePlatform()
Return the name of the target database to operate on.


setGenerateDdl

public void setGenerateDdl(boolean generateDdl)
Set whether to generate DDL after the EntityManagerFactory has been initialized, creating/updating all relevant tables.

Note that the exact semantics of this flag depend on the underlying persistence provider. For any more advanced needs, specify the appropriate vendor-specific settings as "jpaProperties".

See Also:
AbstractEntityManagerFactoryBean.setJpaProperties(java.util.Properties)

isGenerateDdl

protected boolean isGenerateDdl()
Return whether to generate DDL after the EntityManagerFactory has been initialized creating/updating all relevant tables.


setShowSql

public void setShowSql(boolean showSql)
Set whether to show SQL in the log (or in the console).

For more specific logging configuration, specify the appropriate vendor-specific settings as "jpaProperties".

See Also:
AbstractEntityManagerFactoryBean.setJpaProperties(java.util.Properties)

isShowSql

protected boolean isShowSql()
Return whether to show SQL in the log (or in the console).


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

getJpaPropertyMap

public java.util.Map<java.lang.String,?> 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
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:
Persistence.createEntityManagerFactory(String, java.util.Map), PersistenceProvider.createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)

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

getEntityManagerFactoryInterface

public java.lang.Class<? extends javax.persistence.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 EntityManagerFactory class here.

Specified by:
getEntityManagerFactoryInterface in interface JpaVendorAdapter

getEntityManagerInterface

public java.lang.Class<? extends javax.persistence.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 EntityManager class here.

Specified by:
getEntityManagerInterface in interface JpaVendorAdapter

postProcessEntityManagerFactory

public void postProcessEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
Post-process the EntityManagerFactory after it has been initialized.

Specified by:
postProcessEntityManagerFactory in interface JpaVendorAdapter
Parameters:
emf - the EntityManagerFactory to process

Spring Framework