亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? localsessionfactorybean.java

?? spring framework 2.5.4源代碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/*
 * Copyright 2002-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.orm.hibernate3;

import java.io.File;
import java.lang.reflect.Array;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

import javax.sql.DataSource;
import javax.transaction.TransactionManager;

import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cache.CacheProvider;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.event.EventListeners;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.transaction.JTATransactionFactory;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
import org.springframework.jdbc.support.JdbcUtils;
import org.springframework.jdbc.support.lob.LobHandler;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

/**
 * {@link org.springframework.beans.factory.FactoryBean} that creates a
 * Hibernate {@link 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.
 *
 * <p>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.
 *
 * <p>This SessionFactory handling strategy is appropriate for most types of
 * applications, from Hibernate-only single database apps to ones that need
 * distributed transactions. Either {@link HibernateTransactionManager} or
 * {@link org.springframework.transaction.jta.JtaTransactionManager} can be
 * used for transaction demarcation, with the latter only necessary for
 * transactions which span multiple databases.
 *
 * <p>This factory bean will by default expose a transaction-aware SessionFactory
 * proxy, letting data access code work with the plain Hibernate SessionFactory
 * and its <code>getCurrentSession()</code> 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,
 * <code>getCurrentSession()</code> will also seamlessly work with
 * a request-scoped Session managed by
 * {@link org.springframework.orm.hibernate3.support.OpenSessionInViewFilter} /
 * {@link org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor}.
 *
 * <p><b>Requires Hibernate 3.1 or later.</b> 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). Hibernate 3.0 used "on_close"
 * as its own default too; however, Hibernate 3.1 changed this to "auto"
 * (i.e. "after_statement" or "after_transaction").
 *
 * @author Juergen Hoeller
 * @since 1.2
 * @see HibernateTemplate#setSessionFactory
 * @see HibernateTransactionManager#setSessionFactory
 * @see #setExposeTransactionAwareSessionFactory
 * @see #setJtaTransactionManager
 * @see org.hibernate.SessionFactory#getCurrentSession()
 * @see HibernateTransactionManager
 */
public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implements BeanClassLoaderAware {

	private static final ThreadLocal configTimeDataSourceHolder = new ThreadLocal();

	private static final ThreadLocal configTimeTransactionManagerHolder = new ThreadLocal();

	private static final ThreadLocal configTimeCacheProviderHolder = new ThreadLocal();

	private static final ThreadLocal configTimeLobHandlerHolder = new ThreadLocal();

	/**
	 * Return the DataSource for the currently configured Hibernate SessionFactory,
	 * to be used by LocalDataSourceConnectionProvoder.
	 * <p>This instance will be set before initialization of the corresponding
	 * SessionFactory, and reset immediately afterwards. It is thus only available
	 * during configuration.
	 * @see #setDataSource
	 * @see LocalDataSourceConnectionProvider
	 */
	public static DataSource getConfigTimeDataSource() {
		return (DataSource) configTimeDataSourceHolder.get();
	}

	/**
	 * Return the JTA TransactionManager for the currently configured Hibernate
	 * SessionFactory, to be used by LocalTransactionManagerLookup.
	 * <p>This instance will be set before initialization of the corresponding
	 * SessionFactory, and reset immediately afterwards. It is thus only available
	 * during configuration.
	 * @see #setJtaTransactionManager
	 * @see LocalTransactionManagerLookup
	 */
	public static TransactionManager getConfigTimeTransactionManager() {
		return (TransactionManager) configTimeTransactionManagerHolder.get();
	}

	/**
	 * Return the CacheProvider for the currently configured Hibernate SessionFactory,
	 * to be used by LocalCacheProviderProxy.
	 * <p>This instance will be set before initialization of the corresponding
	 * SessionFactory, and reset immediately afterwards. It is thus only available
	 * during configuration.
	 * @see #setCacheProvider
	 */
	public static CacheProvider getConfigTimeCacheProvider() {
		return (CacheProvider) configTimeCacheProviderHolder.get();
	}

	/**
	 * Return the LobHandler for the currently configured Hibernate SessionFactory,
	 * to be used by UserType implementations like ClobStringType.
	 * <p>This instance will be set before initialization of the corresponding
	 * SessionFactory, and reset immediately afterwards. It is thus only available
	 * during configuration.
	 * @see #setLobHandler
	 * @see org.springframework.orm.hibernate3.support.ClobStringType
	 * @see org.springframework.orm.hibernate3.support.BlobByteArrayType
	 * @see org.springframework.orm.hibernate3.support.BlobSerializableType
	 */
	public static LobHandler getConfigTimeLobHandler() {
		return (LobHandler) configTimeLobHandlerHolder.get();
	}


	private Class configurationClass = Configuration.class;

	private Resource[] configLocations;

	private String[] mappingResources;

	private Resource[] mappingLocations;

	private Resource[] cacheableMappingLocations;

	private Resource[] mappingJarLocations;

	private Resource[] mappingDirectoryLocations;

	private Properties hibernateProperties;

	private TransactionManager jtaTransactionManager;

	private CacheProvider cacheProvider;

	private LobHandler lobHandler;

	private Interceptor entityInterceptor;

	private NamingStrategy namingStrategy;

	private TypeDefinitionBean[] typeDefinitions;

	private FilterDefinition[] filterDefinitions;

	private Properties entityCacheStrategies;

	private Properties collectionCacheStrategies;

	private Map eventListeners;

	private boolean schemaUpdate = false;

	private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();

	private Configuration configuration;


	/**
	 * Specify the Hibernate Configuration class to use.
	 * Default is "org.hibernate.cfg.Configuration"; any subclass of
	 * this default Hibernate Configuration class can be specified.
	 * <p>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).
	 * <p>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.
	 * @see #setConfigLocation
	 * @see org.hibernate.cfg.Configuration
	 * @see org.hibernate.cfg.AnnotationConfiguration
	 */
	public void setConfigurationClass(Class configurationClass) {
		if (configurationClass == null || !Configuration.class.isAssignableFrom(configurationClass)) {
			throw new IllegalArgumentException(
					"configurationClass must be assignable to [org.hibernate.cfg.Configuration]");
		}
		this.configurationClass = configurationClass;
	}

	/**
	 * Set the location of a single Hibernate XML config file, for example as
	 * classpath resource "classpath:hibernate.cfg.xml".
	 * <p>Note: Can be omitted when all necessary properties and mapping
	 * resources are specified locally via this bean.
	 * @see org.hibernate.cfg.Configuration#configure(java.net.URL)
	 */
	public void setConfigLocation(Resource configLocation) {
		this.configLocations = new Resource[] {configLocation};
	}

	/**
	 * Set the locations of multiple Hibernate XML config files, for example as
	 * classpath resources "classpath:hibernate.cfg.xml,classpath:extension.cfg.xml".
	 * <p>Note: Can be omitted when all necessary properties and mapping
	 * resources are specified locally via this bean.
	 * @see org.hibernate.cfg.Configuration#configure(java.net.URL)
	 */
	public void setConfigLocations(Resource[] configLocations) {
		this.configLocations = configLocations;
	}

	/**
	 * 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.
	 * <p>Can be used to add to mappings from a Hibernate XML config file,
	 * or to specify all mappings locally.
	 * @see #setMappingLocations
	 * @see org.hibernate.cfg.Configuration#addResource
	 */
	public void setMappingResources(String[] mappingResources) {
		this.mappingResources = mappingResources;
	}

	/**
	 * 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.
	 * <p>Can be used to add to mappings from a Hibernate XML config file,
	 * or to specify all mappings locally.
	 * @see org.hibernate.cfg.Configuration#addInputStream
	 */
	public void setMappingLocations(Resource[] mappingLocations) {
		this.mappingLocations = mappingLocations;
	}

	/**
	 * 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.
	 * <p>Can be used to add to mappings from a Hibernate XML config file,
	 * or to specify all mappings locally.
	 * @see org.hibernate.cfg.Configuration#addCacheableFile(java.io.File)
	 */
	public void setCacheableMappingLocations(Resource[] cacheableMappingLocations) {
		this.cacheableMappingLocations = cacheableMappingLocations;
	}

	/**
	 * Set locations of jar files that contain Hibernate mapping resources,
	 * like "WEB-INF/lib/example.hbm.jar".
	 * <p>Can be used to add to mappings from a Hibernate XML config file,
	 * or to specify all mappings locally.
	 * @see org.hibernate.cfg.Configuration#addJar(java.io.File)
	 */
	public void setMappingJarLocations(Resource[] mappingJarLocations) {
		this.mappingJarLocations = mappingJarLocations;
	}

	/**
	 * Set locations of directories that contain Hibernate mapping resources,
	 * like "WEB-INF/mappings".
	 * <p>Can be used to add to mappings from a Hibernate XML config file,
	 * or to specify all mappings locally.
	 * @see org.hibernate.cfg.Configuration#addDirectory(java.io.File)
	 */
	public void setMappingDirectoryLocations(Resource[] mappingDirectoryLocations) {
		this.mappingDirectoryLocations = mappingDirectoryLocations;
	}

	/**
	 * Set Hibernate properties, such as "hibernate.dialect".
	 * <p>Can be used to override values in a Hibernate XML config file,
	 * or to specify all necessary properties locally.
	 * <p>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.
	 * @see #setDataSource
	 */
	public void setHibernateProperties(Properties hibernateProperties) {
		this.hibernateProperties = hibernateProperties;
	}

	/**
	 * Return the Hibernate properties, if any. Mainly available for
	 * configuration through property paths that specify individual keys.
	 */
	public Properties getHibernateProperties() {
		if (this.hibernateProperties == null) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩在线播放三区| 成人看片黄a免费看在线| 欧美电影一区二区三区| 亚洲高清不卡在线| 欧美一个色资源| 韩国v欧美v亚洲v日本v| 久久婷婷久久一区二区三区| 国产电影精品久久禁18| 国产精品久久久久久久裸模| 一本大道综合伊人精品热热| 亚洲第一久久影院| 日韩欧美www| 成人激情动漫在线观看| 亚洲最大的成人av| 91精品免费观看| 国产成人丝袜美腿| 亚洲三级免费观看| 在线成人av网站| 国产乱码精品1区2区3区| 亚洲视频一二区| 欧美精品vⅰdeose4hd| 国产自产视频一区二区三区| 亚洲青青青在线视频| 欧美人动与zoxxxx乱| 国产精品亚洲人在线观看| 国产精品久久久久毛片软件| 7777精品伊人久久久大香线蕉 | 樱花草国产18久久久久| 在线电影一区二区三区| 国产成人综合在线观看| 天堂va蜜桃一区二区三区| 久久久精品国产99久久精品芒果| 在线免费不卡电影| 激情综合色综合久久综合| 亚洲欧美日韩综合aⅴ视频| 日韩三区在线观看| 成人午夜视频免费看| 日本视频免费一区| 国产精品国产三级国产普通话99| 欧美日韩成人综合天天影院| 成人a区在线观看| 日韩国产精品久久久| 国产精品传媒入口麻豆| 日韩欧美国产三级电影视频| 日本道在线观看一区二区| 国产精品一区二区你懂的| 三级在线观看一区二区| 亚洲欧美一区二区三区孕妇| 久久久精品蜜桃| 日韩精品一区二区三区中文精品| 欧美影院精品一区| 成人激情免费视频| 精品一二线国产| 日韩精品五月天| 五月综合激情日本mⅴ| 国产精品视频第一区| 久久久久久99精品| 日韩一区二区三区电影在线观看| 欧美在线短视频| 91福利视频久久久久| 成人av网在线| 在线免费精品视频| 成人app软件下载大全免费| 国产精品系列在线观看| 精品亚洲porn| 久久99精品国产.久久久久久 | 亚洲视频香蕉人妖| 欧美韩国日本一区| 亚洲精品在线三区| 日韩精品影音先锋| 日韩欧美国产一区在线观看| 欧美色中文字幕| 欧美精品成人一区二区三区四区| 欧美三级乱人伦电影| 欧美视频一区二区三区在线观看| 91视频免费看| 一本色道a无线码一区v| 色诱视频网站一区| 精品视频一区二区不卡| 欧美亚洲自拍偷拍| 91豆麻精品91久久久久久| 色综合天天性综合| 色视频一区二区| 欧美三级视频在线| 欧美日韩精品一区二区在线播放| 欧美三级电影在线看| 欧美日韩成人综合天天影院| 91精品国产综合久久精品麻豆| 欧美丰满一区二区免费视频| 日韩欧美激情在线| 国产日韩高清在线| 国产精品不卡一区二区三区| 一区二区三区四区高清精品免费观看 | 成av人片一区二区| 成人教育av在线| 在线亚洲人成电影网站色www| 在线免费视频一区二区| 日韩三级免费观看| 久久精品亚洲一区二区三区浴池| 国产精品三级久久久久三级| 一区二区三区日韩精品| 日韩精品国产欧美| 国产精品亚洲专一区二区三区| caoporen国产精品视频| 国产精品美女久久久久aⅴ | 一区二区三区在线视频免费观看| 亚洲自拍偷拍九九九| 日本vs亚洲vs韩国一区三区二区| 狠狠色狠狠色综合日日91app| 99在线精品一区二区三区| 欧美性色黄大片手机版| 欧美精品一区男女天堂| 最新成人av在线| 亚洲va欧美va人人爽午夜| 国产在线播放一区| 91免费版在线| 欧美成va人片在线观看| 国产精品久久久久久久久免费桃花| 亚洲精品国产精品乱码不99| 免费观看日韩av| 91论坛在线播放| 日韩精品一区二区三区在线| 亚洲人成7777| 国内成人免费视频| 欧美视频三区在线播放| 欧美国产精品劲爆| 日韩二区三区四区| 91捆绑美女网站| 精品福利一二区| 亚洲午夜羞羞片| jiyouzz国产精品久久| 日韩欧美视频一区| 亚洲国产wwwccc36天堂| 粉嫩av亚洲一区二区图片| 7777精品伊人久久久大香线蕉最新版| 国产精品久久久久久久久动漫| 久久电影网站中文字幕| 欧美三片在线视频观看| 亚洲欧洲成人自拍| 黄色成人免费在线| 777xxx欧美| 亚洲午夜精品在线| 99久久99久久免费精品蜜臀| 久久久久久久久久久久久夜| 麻豆一区二区三区| 538prom精品视频线放| 一区二区三区日韩在线观看| 成人午夜视频福利| 久久精品视频在线免费观看| 日韩不卡一二三区| 欧美日韩一区二区在线观看视频| 自拍av一区二区三区| 成人午夜碰碰视频| 久久精品视频在线看| 蜜臀精品久久久久久蜜臀| 欧美少妇xxx| 亚洲自拍偷拍网站| 欧美色爱综合网| 亚洲国产一区二区三区| 欧洲av一区二区嗯嗯嗯啊| 亚洲三级电影网站| 94-欧美-setu| |精品福利一区二区三区| 成人精品gif动图一区| 欧美激情艳妇裸体舞| 国产.精品.日韩.另类.中文.在线.播放| 精品国产一区二区三区久久影院| 蜜桃精品视频在线观看| 欧美tickling网站挠脚心| 男人的天堂亚洲一区| 日韩欧美黄色影院| 极品少妇xxxx偷拍精品少妇| 日韩欧美激情一区| 久久se精品一区二区| 精品国产精品一区二区夜夜嗨| 精品一区二区三区久久| 久久精品一区蜜桃臀影院| 国产成人8x视频一区二区 | 精品国产乱码久久久久久1区2区 | 亚洲一区二区免费视频| 欧美日韩国产免费一区二区| 首页国产丝袜综合| 日韩一区二区三区四区| 国产伦精品一区二区三区视频青涩| 久久综合精品国产一区二区三区 | 韩国女主播一区| 欧美国产一区在线| 99久久久精品| 亚洲国产精品久久人人爱蜜臀| 欧美日韩精品欧美日韩精品一| 免费在线欧美视频| 久久久久久夜精品精品免费| 成人深夜在线观看| 亚洲综合成人在线| 日韩欧美亚洲国产精品字幕久久久| 国产精品1024| 一区二区在线免费| 欧美成人精品二区三区99精品| 懂色av一区二区三区免费观看 | 六月丁香婷婷色狠狠久久|