类 LocalSessionFactoryBean
- java.lang.Object
- org.springframework.orm.hibernate3.HibernateExceptionTranslator
- org.springframework.orm.hibernate3.AbstractSessionFactoryBean
- org.springframework.orm.hibernate3.LocalSessionFactoryBean
- 所有已实现的接口:
Aware
,BeanClassLoaderAware
,DisposableBean
,FactoryBean<SessionFactory>
,InitializingBean
,PersistenceExceptionTranslator
- 直接已知子类:
AnnotationSessionFactoryBean
@Deprecated public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implements BeanClassLoaderAware
已过时。as of Spring 4.3, in favor of Hibernate 4.x/5.xFactoryBean
that creates a HibernateSessionFactory
. 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
orJtaTransactionManager
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 byOpenSessionInViewFilter
/OpenSessionInViewInterceptor
.Requires Hibernate 3.6.x, as of Spring 4.0. 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).
- 从以下版本开始:
- 1.2
- 作者:
- Juergen Hoeller
- 另请参阅:
HibernateAccessor.setSessionFactory(org.hibernate.SessionFactory)
,HibernateTransactionManager.setSessionFactory(org.hibernate.SessionFactory)
,AbstractSessionFactoryBean.setExposeTransactionAwareSessionFactory(boolean)
,setJtaTransactionManager(javax.transaction.TransactionManager)
,SessionFactory.getCurrentSession()
,HibernateTransactionManager
字段概要
从类继承的字段 org.springframework.orm.hibernate3.AbstractSessionFactoryBean
logger
构造器概要
构造器 构造器 说明 LocalSessionFactoryBean()
已过时。
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 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(Connection con, String[] sql)
已过时。Execute the given schema script on the given JDBC Connection.protected void
executeSchemaStatement(Statement stmt, String sql)
已过时。Execute the given schema SQL on the given JDBC Statement.static 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.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.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 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 register further mappings on the Configuration object after this FactoryBean registered its specified mappings.void
setBeanClassLoader(ClassLoader beanClassLoader)
已过时。Callback that supplies the beanclass 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
setCacheRegionFactory(RegionFactory cacheRegionFactory)
已过时。Set the Hibernate RegionFactory to use for the SessionFactory.void
setCollectionCacheStrategies(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(Class<?> configurationClass)
已过时。Specify the Hibernate Configuration class to use.void
setEntityCacheStrategies(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(Map<String,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(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(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.从类继承的方法 org.springframework.orm.hibernate3.AbstractSessionFactoryBean
afterPropertiesSet, beforeSessionFactoryDestruction, getDataSource, getObject, getObjectType, getSessionFactory, isExposeTransactionAwareSessionFactory, isSingleton, isUseTransactionAwareDataSource, setDataSource, setExposeTransactionAwareSessionFactory, setUseTransactionAwareDataSource, wrapSessionFactoryIfNecessary
从类继承的方法 org.springframework.orm.hibernate3.HibernateExceptionTranslator
convertHibernateAccessException, setJdbcExceptionTranslator, translateExceptionIfPossible
构造器详细资料
LocalSessionFactoryBean
public LocalSessionFactoryBean()
已过时。
方法详细资料
getConfigTimeDataSource
public static DataSource getConfigTimeDataSource()
已过时。Return the DataSource for the currently configured Hibernate SessionFactory, to be used by LocalDataSourceConnectionProvoder.This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
getConfigTimeTransactionManager
public static TransactionManager getConfigTimeTransactionManager()
已过时。Return the JTA TransactionManager for the currently configured Hibernate SessionFactory, to be used by LocalTransactionManagerLookup.This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
getConfigTimeLobHandler
public static LobHandler getConfigTimeLobHandler()
已过时。Return the LobHandler for the currently configured Hibernate SessionFactory, to be used by UserType implementations like ClobStringType.This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
setConfigurationClass
public void setConfigurationClass(Class<?> configurationClass)
已过时。Specify the Hibernate Configuration class to use.Default is
Configuration
; any subclass of this default Hibernate Configuration class can be specified.
setConfigLocation
public void setConfigLocation(Resource configLocation)
已过时。Set the location of a single Hibernate XML config file, for example as classpath resource "classpath:hibernate.cfg.xml".Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
setConfigLocations
public 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".Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
setMappingResources
public void setMappingResources(String... mappingResources)
已过时。Set Hibernate mapping resources to be found in the class path, like "example.hbm.xml" or "mypackage/example.hbm.xml". Analogous to mapping entries in a Hibernate XML config file. Alternative to the more generic setMappingLocations method.Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
setMappingLocations
public void setMappingLocations(Resource... mappingLocations)
已过时。Set locations of Hibernate mapping files, for example as classpath resource "classpath:example.hbm.xml". Supports any resource location via Spring's resource abstraction, for example relative paths like "WEB-INF/mappings/example.hbm.xml" when running in an application context.Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
setCacheableMappingLocations
public void setCacheableMappingLocations(Resource... cacheableMappingLocations)
已过时。Set locations of cacheable Hibernate mapping files, for example as web app resource "/WEB-INF/mapping/example.hbm.xml". Supports any resource location via Spring's resource abstraction, as long as the resource can be resolved in the file system.Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
setMappingJarLocations
public void setMappingJarLocations(Resource... mappingJarLocations)
已过时。Set locations of jar files that contain Hibernate mapping resources, like "WEB-INF/lib/example.hbm.jar".Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
setMappingDirectoryLocations
public void setMappingDirectoryLocations(Resource... mappingDirectoryLocations)
已过时。Set locations of directories that contain Hibernate mapping resources, like "WEB-INF/mappings".Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
setHibernateProperties
public void setHibernateProperties(Properties hibernateProperties)
已过时。Set Hibernate properties, such as "hibernate.dialect".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.
getHibernateProperties
public Properties getHibernateProperties()
已过时。Return the Hibernate properties, if any. Mainly available for configuration through property paths that specify individual keys.
setJtaTransactionManager
public void setJtaTransactionManager(TransactionManager jtaTransactionManager)
已过时。Set the JTA TransactionManager to be used for Hibernate's TransactionManagerLookup. Allows for using a Spring-managed JTA TransactionManager for Hibernate's cache synchronization.Note: If this is set, the Hibernate settings should not define a transaction manager lookup to avoid meaningless double configuration.
setCacheRegionFactory
public void setCacheRegionFactory(RegionFactory cacheRegionFactory)
已过时。Set the Hibernate RegionFactory to use for the SessionFactory. Allows for using a Spring-managed RegionFactory instance.Note: If this is set, the Hibernate settings should not define a cache provider to avoid meaningless double configuration.
- 另请参阅:
RegionFactory
setLobHandler
public void setLobHandler(LobHandler lobHandler)
已过时。Set the LobHandler to be used by the SessionFactory. Will be exposed at config time for UserType implementations.
setEntityInterceptor
public 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. Will get applied to any new Session created by this factory.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.
setNamingStrategy
public 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.
setTypeDefinitions
public void setTypeDefinitions(TypeDefinitionBean... typeDefinitions)
已过时。Specify the Hibernate type definitions to register with the SessionFactory, as Spring TypeDefinitionBean instances. This is an alternative to specifying <<typedef> elements in Hibernate mapping files.Unfortunately, Hibernate itself does not define a complete object that represents a type definition, hence the need for Spring's TypeDefinitionBean.
setFilterDefinitions
public void setFilterDefinitions(FilterDefinition... filterDefinitions)
已过时。Specify the Hibernate FilterDefinitions to register with the SessionFactory. This is an alternative to specifying <<filter-def> elements in Hibernate mapping files.Typically, the passed-in FilterDefinition objects will have been defined as Spring FilterDefinitionFactoryBeans, probably as inner beans within the LocalSessionFactoryBean definition.
setEntityCacheStrategies
public void setEntityCacheStrategies(Properties entityCacheStrategies)
已过时。Specify the cache strategies for entities (persistent classes or named entities). This configuration setting corresponds to the <class-cache> entry in the "hibernate.cfg.xml" configuration format.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 values- 另请参阅:
Configuration.setCacheConcurrencyStrategy(String, String)
setCollectionCacheStrategies
public void setCollectionCacheStrategies(Properties collectionCacheStrategies)
已过时。Specify the cache strategies for persistent collections (with specific roles). This configuration setting corresponds to the <collection-cache> entry in the "hibernate.cfg.xml" configuration format.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 values- 另请参阅:
Configuration.setCollectionCacheConcurrencyStrategy(String, String)
setEventListeners
public void setEventListeners(Map<String,Object> eventListeners)
已过时。Specify the Hibernate event listeners to register, with listener types as keys and listener objects as values. Instead of a single listener object, you can also pass in a list or set of listeners objects as value.See the Hibernate documentation for further details on listener types and associated listener interfaces.
See
org.hibernate.cfg.Configuration#setListener(String, Object)
- 参数:
eventListeners
- Map with listener type Strings as keys and listener objects as values
setSchemaUpdate
public void setSchemaUpdate(boolean schemaUpdate)
已过时。Set whether to execute a schema update after SessionFactory initialization.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.
setBeanClassLoader
public void setBeanClassLoader(ClassLoader beanClassLoader)
已过时。从接口复制的说明:BeanClassLoaderAware
Callback that supplies the beanclass 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
在接口中BeanClassLoaderAware
- 参数:
beanClassLoader
- the owning class loader; may benull
in which case a defaultClassLoader
must be used, for example theClassLoader
obtained viaClassUtils.getDefaultClassLoader()
buildSessionFactory
protected SessionFactory buildSessionFactory() throws Exception
已过时。从类复制的说明:AbstractSessionFactoryBean
Build the underlying Hibernate SessionFactory.- 指定者:
buildSessionFactory
在类中AbstractSessionFactoryBean
- 返回:
- the raw SessionFactory (potentially to be wrapped with a transaction-aware proxy before it is exposed to the application)
- 抛出:
Exception
- in case of initialization failure
newConfiguration
protected Configuration newConfiguration() throws HibernateException
已过时。Subclasses can override this method to perform custom initialization of the Configuration instance used for SessionFactory creation. The properties of this LocalSessionFactoryBean will be applied to the Configuration object that gets returned here.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.
- 返回:
- the Configuration instance
- 抛出:
HibernateException
- in case of Hibernate initialization errors- 另请参阅:
Configuration()
postProcessMappings
protected void postProcessMappings(Configuration config) throws HibernateException
已过时。To be implemented by subclasses that want to register further mappings on the Configuration object after this FactoryBean registered its specified mappings.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 errors- 另请参阅:
Configuration.buildMappings()
postProcessConfiguration
protected void postProcessConfiguration(Configuration config) throws HibernateException
已过时。To be implemented by subclasses that want to perform custom post-processing of the Configuration object after this FactoryBean performed its default initialization.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 errors- 另请参阅:
Configuration.buildMappings()
newSessionFactory
protected SessionFactory newSessionFactory(Configuration config) throws HibernateException
已过时。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.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- 返回:
- the SessionFactory instance
- 抛出:
HibernateException
- in case of Hibernate initialization errors- 另请参阅:
Configuration.buildSessionFactory(org.hibernate.service.ServiceRegistry)
getConfiguration
public final Configuration getConfiguration()
已过时。Return the Configuration object used to build the SessionFactory. Allows for access to configuration metadata stored there (rarely needed).- 抛出:
IllegalStateException
- if the Configuration object has not been initialized yet
afterSessionFactoryCreation
protected void afterSessionFactoryCreation() throws Exception
已过时。Executes schema update if requested.- 覆盖:
afterSessionFactoryCreation
在类中AbstractSessionFactoryBean
- 抛出:
Exception
- in case of initialization failure- 另请参阅:
setSchemaUpdate(boolean)
,updateDatabaseSchema()
destroy
public void destroy() throws HibernateException
已过时。Allows for schema export on shutdown.- 指定者:
destroy
在接口中DisposableBean
- 覆盖:
destroy
在类中AbstractSessionFactoryBean
- 抛出:
HibernateException
updateDatabaseSchema
public void updateDatabaseSchema() throws DataAccessException
已过时。Execute schema update script, determined by the Configuration object used for creating the SessionFactory. A replacement for Hibernate's SchemaUpdate class, for automatically executing schema update scripts on application startup. Can also be invoked manually.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 errors- 另请参阅:
setSchemaUpdate(boolean)
,Configuration.generateSchemaUpdateScript(org.hibernate.dialect.Dialect, org.hibernate.tool.hbm2ddl.DatabaseMetadata)
,SchemaUpdate
validateDatabaseSchema
public void validateDatabaseSchema() throws DataAccessException
已过时。Execute schema creation script, determined by the Configuration object used for creating the SessionFactory. A replacement for Hibernate's SchemaValidator class, to be invoked after application startup.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 errors- 另请参阅:
Configuration.validateSchema(org.hibernate.dialect.Dialect, org.hibernate.tool.hbm2ddl.DatabaseMetadata)
,SchemaValidator
dropDatabaseSchema
public void dropDatabaseSchema() throws DataAccessException
已过时。Execute schema drop script, determined by the Configuration object used for creating the SessionFactory. A replacement for Hibernate's SchemaExport class, to be invoked on application setup.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 errors- 另请参阅:
Configuration.generateDropSchemaScript(org.hibernate.dialect.Dialect)
,SchemaExport.drop(boolean, boolean)
createDatabaseSchema
public void createDatabaseSchema() throws DataAccessException
已过时。Execute schema creation script, determined by the Configuration object used for creating the SessionFactory. A replacement for Hibernate's SchemaExport class, to be invoked on application setup.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 errors- 另请参阅:
Configuration.generateSchemaCreationScript(org.hibernate.dialect.Dialect)
,SchemaExport.create(boolean, boolean)
executeSchemaScript
protected void executeSchemaScript(Connection con, String[] sql) throws SQLException
已过时。Execute the given schema script on the given JDBC Connection.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- 抛出:
SQLException
- if thrown by JDBC methods- 另请参阅:
executeSchemaStatement(java.sql.Statement, java.lang.String)
executeSchemaStatement
protected void executeSchemaStatement(Statement stmt, String sql) throws SQLException
已过时。Execute the given schema SQL on the given JDBC Statement.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- 抛出:
SQLException
- if thrown by JDBC methods (and considered fatal)