|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.orm.hibernate3.AbstractSessionFactoryBean
org.springframework.orm.hibernate3.LocalSessionFactoryBean
public class LocalSessionFactoryBean
FactoryBean
that creates a
Hibernate org.hibernate.SessionFactory
. This is the usual way to
set up a shared Hibernate SessionFactory in a Spring application context;
the SessionFactory can then be passed to Hibernate-based DAOs via
dependency injection.
Configuration settings can either be read from a Hibernate XML file, specified as "configLocation", or completely via this class. A typical local configuration consists of one or more "mappingResources", various "hibernateProperties" (not strictly necessary), and a "dataSource" that the SessionFactory should use. The latter can also be specified via Hibernate properties, but "dataSource" supports any Spring-configured DataSource, instead of relying on Hibernate's own connection providers.
This SessionFactory handling strategy is appropriate for most types of
applications, from Hibernate-only single database apps to ones that need
distributed transactions. Either HibernateTransactionManager
or
JtaTransactionManager
can be
used for transaction demarcation, with the latter only necessary for
transactions which span multiple databases.
This factory bean will by default expose a transaction-aware SessionFactory
proxy, letting data access code work with the plain Hibernate SessionFactory
and its getCurrentSession()
method, while still being able to
participate in current Spring-managed transactions: with any transaction
management strategy, either local or JTA / EJB CMT, and any transaction
synchronization mechanism, either Spring or JTA. Furthermore,
getCurrentSession()
will also seamlessly work with
a request-scoped Session managed by
OpenSessionInViewFilter
/
OpenSessionInViewInterceptor
.
Requires Hibernate 3.2 or later; tested with 3.3, 3.5 and 3.6. Note that this factory will use "on_close" as default Hibernate connection release mode, unless in the case of a "jtaTransactionManager" specified, for the reason that this is appropriate for most Spring-based applications (in particular when using Spring's HibernateTransactionManager).
HibernateAccessor.setSessionFactory(SessionFactory)
,
HibernateTransactionManager.setSessionFactory(SessionFactory)
,
AbstractSessionFactoryBean.setExposeTransactionAwareSessionFactory(boolean)
,
setJtaTransactionManager(TransactionManager)
,
org.hibernate.SessionFactory#getCurrentSession()
,
HibernateTransactionManager
Field Summary | |
---|---|
private java.lang.ClassLoader |
beanClassLoader
|
private Resource[] |
cacheableMappingLocations
|
private CacheProvider |
cacheProvider
|
private java.lang.Object |
cacheRegionFactory
|
private java.util.Properties |
collectionCacheStrategies
|
private Resource[] |
configLocations
|
private static java.lang.ThreadLocal<CacheProvider> |
configTimeCacheProviderHolder
|
private static java.lang.ThreadLocal<javax.sql.DataSource> |
configTimeDataSourceHolder
|
private static java.lang.ThreadLocal<LobHandler> |
configTimeLobHandlerHolder
|
private static java.lang.ThreadLocal<java.lang.Object> |
configTimeRegionFactoryHolder
|
private static java.lang.ThreadLocal<TransactionManager> |
configTimeTransactionManagerHolder
|
private Configuration |
configuration
|
private java.lang.Class<? extends Configuration> |
configurationClass
|
private java.util.Properties |
entityCacheStrategies
|
private Interceptor |
entityInterceptor
|
private java.util.Map<java.lang.String,java.lang.Object> |
eventListeners
|
private FilterDefinition[] |
filterDefinitions
|
private java.util.Properties |
hibernateProperties
|
private TransactionManager |
jtaTransactionManager
|
private LobHandler |
lobHandler
|
private Resource[] |
mappingDirectoryLocations
|
private Resource[] |
mappingJarLocations
|
private Resource[] |
mappingLocations
|
private java.lang.String[] |
mappingResources
|
private NamingStrategy |
namingStrategy
|
private boolean |
schemaUpdate
|
private TypeDefinitionBean[] |
typeDefinitions
|
Fields inherited from class org.springframework.orm.hibernate3.AbstractSessionFactoryBean |
---|
logger |
Constructor Summary | |
---|---|
LocalSessionFactoryBean()
|
Method Summary | |
---|---|
protected void |
afterSessionFactoryCreation()
Executes schema update if requested. |
protected SessionFactory |
buildSessionFactory()
Build the underlying Hibernate SessionFactory. |
void |
createDatabaseSchema()
Execute schema creation script, determined by the Configuration object used for creating the SessionFactory. |
void |
destroy()
Allows for schema export on shutdown. |
void |
dropDatabaseSchema()
Execute schema drop script, determined by the Configuration object used for creating the SessionFactory. |
protected void |
executeSchemaScript(java.sql.Connection con,
java.lang.String[] sql)
Execute the given schema script on the given JDBC Connection. |
protected void |
executeSchemaStatement(java.sql.Statement stmt,
java.lang.String sql)
Execute the given schema SQL on the given JDBC Statement. |
static CacheProvider |
getConfigTimeCacheProvider()
Return the CacheProvider for the currently configured Hibernate SessionFactory, to be used by LocalCacheProviderProxy. |
static javax.sql.DataSource |
getConfigTimeDataSource()
Return the DataSource for the currently configured Hibernate SessionFactory, to be used by LocalDataSourceConnectionProvoder. |
static LobHandler |
getConfigTimeLobHandler()
Return the LobHandler for the currently configured Hibernate SessionFactory, to be used by UserType implementations like ClobStringType. |
(package private) static java.lang.Object |
getConfigTimeRegionFactory()
Return the RegionFactory for the currently configured Hibernate SessionFactory, to be used by LocalRegionFactoryProxy. |
static TransactionManager |
getConfigTimeTransactionManager()
Return the JTA TransactionManager for the currently configured Hibernate SessionFactory, to be used by LocalTransactionManagerLookup. |
Configuration |
getConfiguration()
Return the Configuration object used to build the SessionFactory. |
java.util.Properties |
getHibernateProperties()
Return the Hibernate properties, if any. |
protected Configuration |
newConfiguration()
Subclasses can override this method to perform custom initialization of the Configuration instance used for SessionFactory creation. |
protected SessionFactory |
newSessionFactory(Configuration config)
Subclasses can override this method to perform custom initialization of the SessionFactory instance, creating it via the given Configuration object that got prepared by this LocalSessionFactoryBean. |
protected void |
postProcessConfiguration(Configuration config)
To be implemented by subclasses that want to to perform custom post-processing of the Configuration object after this FactoryBean performed its default initialization. |
protected void |
postProcessMappings(Configuration config)
To be implemented by subclasses that want to to register further mappings on the Configuration object after this FactoryBean registered its specified mappings. |
void |
setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
Callback that supplies the bean class loader to
a bean instance. |
void |
setCacheableMappingLocations(Resource[] cacheableMappingLocations)
Set locations of cacheable Hibernate mapping files, for example as web app resource "/WEB-INF/mapping/example.hbm.xml". |
void |
setCacheProvider(CacheProvider cacheProvider)
Deprecated. as of Spring 3.0, following Hibernate 3.3's deprecation of the CacheProvider SPI |
void |
setCacheRegionFactory(java.lang.Object cacheRegionFactory)
Set the Hibernate RegionFactory to use for the SessionFactory. |
void |
setCollectionCacheStrategies(java.util.Properties collectionCacheStrategies)
Specify the cache strategies for persistent collections (with specific roles). |
void |
setConfigLocation(Resource configLocation)
Set the location of a single Hibernate XML config file, for example as classpath resource "classpath:hibernate.cfg.xml". |
void |
setConfigLocations(Resource[] configLocations)
Set the locations of multiple Hibernate XML config files, for example as classpath resources "classpath:hibernate.cfg.xml,classpath:extension.cfg.xml". |
void |
setConfigurationClass(java.lang.Class<?> configurationClass)
Specify the Hibernate Configuration class to use. |
void |
setEntityCacheStrategies(java.util.Properties entityCacheStrategies)
Specify the cache strategies for entities (persistent classes or named entities). |
void |
setEntityInterceptor(Interceptor entityInterceptor)
Set a Hibernate entity interceptor that allows to inspect and change property values before writing to and reading from the database. |
void |
setEventListeners(java.util.Map<java.lang.String,java.lang.Object> eventListeners)
Specify the Hibernate event listeners to register, with listener types as keys and listener objects as values. |
void |
setFilterDefinitions(FilterDefinition[] filterDefinitions)
Specify the Hibernate FilterDefinitions to register with the SessionFactory. |
void |
setHibernateProperties(java.util.Properties hibernateProperties)
Set Hibernate properties, such as "hibernate.dialect". |
void |
setJtaTransactionManager(TransactionManager jtaTransactionManager)
Set the JTA TransactionManager to be used for Hibernate's TransactionManagerLookup. |
void |
setLobHandler(LobHandler lobHandler)
Set the LobHandler to be used by the SessionFactory. |
void |
setMappingDirectoryLocations(Resource[] mappingDirectoryLocations)
Set locations of directories that contain Hibernate mapping resources, like "WEB-INF/mappings". |
void |
setMappingJarLocations(Resource[] mappingJarLocations)
Set locations of jar files that contain Hibernate mapping resources, like "WEB-INF/lib/example.hbm.jar". |
void |
setMappingLocations(Resource[] mappingLocations)
Set locations of Hibernate mapping files, for example as classpath resource "classpath:example.hbm.xml". |
void |
setMappingResources(java.lang.String[] mappingResources)
Set Hibernate mapping resources to be found in the class path, like "example.hbm.xml" or "mypackage/example.hbm.xml". |
void |
setNamingStrategy(NamingStrategy namingStrategy)
Set a Hibernate NamingStrategy for the SessionFactory, determining the physical column and table names given the info in the mapping document. |
void |
setSchemaUpdate(boolean schemaUpdate)
Set whether to execute a schema update after SessionFactory initialization. |
void |
setTypeDefinitions(TypeDefinitionBean[] typeDefinitions)
Specify the Hibernate type definitions to register with the SessionFactory, as Spring TypeDefinitionBean instances. |
void |
updateDatabaseSchema()
Execute schema update script, determined by the Configuration object used for creating the SessionFactory. |
void |
validateDatabaseSchema()
Execute schema creation script, determined by the Configuration object used for creating the SessionFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.ThreadLocal<javax.sql.DataSource> configTimeDataSourceHolder
private static final java.lang.ThreadLocal<TransactionManager> configTimeTransactionManagerHolder
private static final java.lang.ThreadLocal<java.lang.Object> configTimeRegionFactoryHolder
private static final java.lang.ThreadLocal<CacheProvider> configTimeCacheProviderHolder
private static final java.lang.ThreadLocal<LobHandler> configTimeLobHandlerHolder
private java.lang.Class<? extends Configuration> configurationClass
private Resource[] configLocations
private java.lang.String[] mappingResources
private Resource[] mappingLocations
private Resource[] cacheableMappingLocations
private Resource[] mappingJarLocations
private Resource[] mappingDirectoryLocations
private java.util.Properties hibernateProperties
private TransactionManager jtaTransactionManager
private java.lang.Object cacheRegionFactory
private CacheProvider cacheProvider
private LobHandler lobHandler
private Interceptor entityInterceptor
private NamingStrategy namingStrategy
private TypeDefinitionBean[] typeDefinitions
private FilterDefinition[] filterDefinitions
private java.util.Properties entityCacheStrategies
private java.util.Properties collectionCacheStrategies
private java.util.Map<java.lang.String,java.lang.Object> eventListeners
private boolean schemaUpdate
private java.lang.ClassLoader beanClassLoader
private Configuration configuration
Constructor Detail |
---|
public LocalSessionFactoryBean()
Method Detail |
---|
public static javax.sql.DataSource getConfigTimeDataSource()
This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
AbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)
,
LocalDataSourceConnectionProvider
public static TransactionManager getConfigTimeTransactionManager()
This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
setJtaTransactionManager(TransactionManager)
,
LocalTransactionManagerLookup
static java.lang.Object getConfigTimeRegionFactory()
This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
setCacheRegionFactory(java.lang.Object)
public static CacheProvider getConfigTimeCacheProvider()
This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
setCacheProvider(CacheProvider)
public static LobHandler getConfigTimeLobHandler()
This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
setLobHandler(org.springframework.jdbc.support.lob.LobHandler)
,
ClobStringType
,
BlobByteArrayType
,
BlobSerializableType
public void setConfigurationClass(java.lang.Class<?> configurationClass)
Can be set to "org.hibernate.cfg.AnnotationConfiguration" for using Hibernate3 annotation support (initially only available as alpha download separate from the main Hibernate3 distribution).
Annotated packages and annotated classes can be specified via the corresponding tags in "hibernate.cfg.xml" then, so this will usually be combined with a "configLocation" property that points at such a standard Hibernate configuration file.
setConfigLocation(org.springframework.core.io.Resource)
,
org.hibernate.cfg.Configuration
,
org.hibernate.cfg.AnnotationConfiguration
public void setConfigLocation(Resource configLocation)
Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
org.hibernate.cfg.Configuration#configure(java.net.URL)
public void setConfigLocations(Resource[] configLocations)
Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
org.hibernate.cfg.Configuration#configure(java.net.URL)
public void setMappingResources(java.lang.String[] mappingResources)
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
setMappingLocations(org.springframework.core.io.Resource[])
,
org.hibernate.cfg.Configuration#addResource
public void setMappingLocations(Resource[] mappingLocations)
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
org.hibernate.cfg.Configuration#addInputStream
public void setCacheableMappingLocations(Resource[] cacheableMappingLocations)
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
org.hibernate.cfg.Configuration#addCacheableFile(java.io.File)
public void setMappingJarLocations(Resource[] mappingJarLocations)
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
org.hibernate.cfg.Configuration#addJar(java.io.File)
public void setMappingDirectoryLocations(Resource[] mappingDirectoryLocations)
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
org.hibernate.cfg.Configuration#addDirectory(java.io.File)
public void setHibernateProperties(java.util.Properties hibernateProperties)
Can be used to override values in a Hibernate XML config file, or to specify all necessary properties locally.
Note: Do not specify a transaction provider here when using Spring-driven transactions. It is also advisable to omit connection provider settings and use a Spring-set DataSource instead.
AbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)
public java.util.Properties getHibernateProperties()
public void setJtaTransactionManager(TransactionManager jtaTransactionManager)
Note: If this is set, the Hibernate settings should not define a transaction manager lookup to avoid meaningless double configuration.
LocalTransactionManagerLookup
public void setCacheRegionFactory(java.lang.Object cacheRegionFactory)
As of Hibernate 3.3, this is the preferred mechanism for configuring
caches, superseding the CacheProvider SPI
.
For Hibernate 3.2 compatibility purposes, the accepted reference is of type
Object: the actual type is org.hibernate.cache.RegionFactory
.
Note: If this is set, the Hibernate settings should not define a cache provider to avoid meaningless double configuration.
org.hibernate.cache.RegionFactory
@Deprecated public void setCacheProvider(CacheProvider cacheProvider)
Note: If this is set, the Hibernate settings should not define a cache provider to avoid meaningless double configuration.
setCacheRegionFactory(java.lang.Object)
public void setLobHandler(LobHandler lobHandler)
getConfigTimeLobHandler()
,
org.hibernate.usertype.UserType
,
ClobStringType
,
BlobByteArrayType
,
BlobSerializableType
public void setEntityInterceptor(Interceptor entityInterceptor)
Such an interceptor can either be set at the SessionFactory level, i.e. on LocalSessionFactoryBean, or at the Session level, i.e. on HibernateTemplate, HibernateInterceptor, and HibernateTransactionManager. It's preferable to set it on LocalSessionFactoryBean or HibernateTransactionManager to avoid repeated configuration and guarantee consistent behavior in transactions.
HibernateAccessor.setEntityInterceptor(Interceptor)
,
HibernateAccessor.setEntityInterceptor(Interceptor)
,
HibernateTransactionManager.setEntityInterceptor(Interceptor)
,
org.hibernate.cfg.Configuration#setInterceptor
public void setNamingStrategy(NamingStrategy namingStrategy)
org.hibernate.cfg.Configuration#setNamingStrategy
public void setTypeDefinitions(TypeDefinitionBean[] typeDefinitions)
Unfortunately, Hibernate itself does not define a complete object that represents a type definition, hence the need for Spring's TypeDefinitionBean.
TypeDefinitionBean
,
org.hibernate.cfg.Mappings#addTypeDef(String, String, java.util.Properties)
public void setFilterDefinitions(FilterDefinition[] filterDefinitions)
Typically, the passed-in FilterDefinition objects will have been defined as Spring FilterDefinitionFactoryBeans, probably as inner beans within the LocalSessionFactoryBean definition.
FilterDefinitionFactoryBean
,
org.hibernate.cfg.Configuration#addFilterDefinition
public void setEntityCacheStrategies(java.util.Properties entityCacheStrategies)
For example:
<property name="entityCacheStrategies"> <props> <prop key="com.mycompany.Customer">read-write</prop> <prop key="com.mycompany.Product">read-only,myRegion</prop> </props> </property>
entityCacheStrategies
- properties that define entity cache strategies,
with class names as keys and cache concurrency strategies as valuesorg.hibernate.cfg.Configuration#setCacheConcurrencyStrategy(String, String)
public void setCollectionCacheStrategies(java.util.Properties collectionCacheStrategies)
For example:
<property name="collectionCacheStrategies"> <props> <prop key="com.mycompany.Order.items">read-write</prop> <prop key="com.mycompany.Product.categories">read-only,myRegion</prop> </props> </property>
collectionCacheStrategies
- properties that define collection cache strategies,
with collection roles as keys and cache concurrency strategies as valuesorg.hibernate.cfg.Configuration#setCollectionCacheConcurrencyStrategy(String, String)
public void setEventListeners(java.util.Map<java.lang.String,java.lang.Object> eventListeners)
See the Hibernate documentation for further details on listener types and associated listener interfaces.
eventListeners
- Map with listener type Strings as keys and
listener objects as valuesorg.hibernate.cfg.Configuration#setListener(String, Object)
public void setSchemaUpdate(boolean schemaUpdate)
For details on how to make schema update scripts work, see the Hibernate documentation, as this class leverages the same schema update script support in org.hibernate.cfg.Configuration as Hibernate's own SchemaUpdate tool.
org.hibernate.cfg.Configuration#generateSchemaUpdateScript
,
org.hibernate.tool.hbm2ddl.SchemaUpdate
public void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
BeanClassLoaderAware
class loader
to
a bean instance.
Invoked after the population of normal bean properties but
before an initialization callback such as
InitializingBean's
InitializingBean.afterPropertiesSet()
method or a custom init-method.
setBeanClassLoader
in interface BeanClassLoaderAware
beanClassLoader
- the owning class loader; may be null
in
which case a default ClassLoader
must be used, for example
the ClassLoader
obtained via
ClassUtils.getDefaultClassLoader()
protected SessionFactory buildSessionFactory() throws java.lang.Exception
AbstractSessionFactoryBean
buildSessionFactory
in class AbstractSessionFactoryBean
java.lang.Exception
- in case of initialization failureprotected Configuration newConfiguration() throws HibernateException
The default implementation creates a new Configuration instance. A custom implementation could prepare the instance in a specific way, or use a custom Configuration subclass.
HibernateException
- in case of Hibernate initialization errorsorg.hibernate.cfg.Configuration#Configuration()
protected void postProcessMappings(Configuration config) throws HibernateException
Invoked before the Configuration.buildMappings()
call,
so that it can still extend and modify the mapping information.
config
- the current Configuration object
HibernateException
- in case of Hibernate initialization errorsorg.hibernate.cfg.Configuration#buildMappings()
protected void postProcessConfiguration(Configuration config) throws HibernateException
Invoked after the Configuration.buildMappings()
call,
so that it can operate on the completed and fully parsed mapping information.
config
- the current Configuration object
HibernateException
- in case of Hibernate initialization errorsorg.hibernate.cfg.Configuration#buildMappings()
protected SessionFactory newSessionFactory(Configuration config) throws HibernateException
The default implementation invokes Configuration's buildSessionFactory. A custom implementation could prepare the instance in a specific way, or use a custom SessionFactoryImpl subclass.
config
- Configuration prepared by this LocalSessionFactoryBean
HibernateException
- in case of Hibernate initialization errorsorg.hibernate.cfg.Configuration#buildSessionFactory
public final Configuration getConfiguration()
java.lang.IllegalStateException
- if the Configuration object has not been initialized yetprotected void afterSessionFactoryCreation() throws java.lang.Exception
afterSessionFactoryCreation
in class AbstractSessionFactoryBean
java.lang.Exception
- in case of initialization failuresetSchemaUpdate(boolean)
,
updateDatabaseSchema()
public void destroy() throws HibernateException
destroy
in interface DisposableBean
destroy
in class AbstractSessionFactoryBean
HibernateException
public void updateDatabaseSchema() throws DataAccessException
Fetch the LocalSessionFactoryBean itself rather than the exposed
SessionFactory to be able to invoke this method, e.g. via
LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");
.
Uses the SessionFactory that this bean generates for accessing a JDBC connection to perform the script.
DataAccessException
- in case of script execution errorssetSchemaUpdate(boolean)
,
org.hibernate.cfg.Configuration#generateSchemaUpdateScript
,
org.hibernate.tool.hbm2ddl.SchemaUpdate
public void validateDatabaseSchema() throws DataAccessException
Fetch the LocalSessionFactoryBean itself rather than the exposed
SessionFactory to be able to invoke this method, e.g. via
LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");
.
Uses the SessionFactory that this bean generates for accessing a JDBC connection to perform the script.
DataAccessException
- in case of script execution errorsorg.hibernate.cfg.Configuration#validateSchema
,
org.hibernate.tool.hbm2ddl.SchemaValidator
public void dropDatabaseSchema() throws DataAccessException
Fetch the LocalSessionFactoryBean itself rather than the exposed
SessionFactory to be able to invoke this method, e.g. via
LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");
.
Uses the SessionFactory that this bean generates for accessing a JDBC connection to perform the script.
DataAccessException
- in case of script execution errorsorg.hibernate.cfg.Configuration#generateDropSchemaScript
,
org.hibernate.tool.hbm2ddl.SchemaExport#drop
public void createDatabaseSchema() throws DataAccessException
Fetch the LocalSessionFactoryBean itself rather than the exposed
SessionFactory to be able to invoke this method, e.g. via
LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");
.
Uses the SessionFactory that this bean generates for accessing a JDBC connection to perform the script.
DataAccessException
- in case of script execution errorsorg.hibernate.cfg.Configuration#generateSchemaCreationScript
,
org.hibernate.tool.hbm2ddl.SchemaExport#create
protected void executeSchemaScript(java.sql.Connection con, java.lang.String[] sql) throws java.sql.SQLException
Note that the default implementation will log unsuccessful statements
and continue to execute. Override the executeSchemaStatement
method to treat failures differently.
con
- the JDBC Connection to execute the script onsql
- the SQL statements to execute
java.sql.SQLException
- if thrown by JDBC methodsexecuteSchemaStatement(java.sql.Statement, java.lang.String)
protected void executeSchemaStatement(java.sql.Statement stmt, java.lang.String sql) throws java.sql.SQLException
Note that the default implementation will log unsuccessful statements and continue to execute. Override this method to treat failures differently.
stmt
- the JDBC Statement to execute the SQL onsql
- the SQL statement to execute
java.sql.SQLException
- if thrown by JDBC methods (and considered fatal)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |