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

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

?? _baserootdao.java

?? hibernate框架例子程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package com.redsaga.hibnatesample.step2.base;

import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.redsaga.hibnatesample.step2.util.ForumInterceptor;

import net.sf.hibernate.Criteria;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import net.sf.hibernate.SessionFactory;

import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.expression.Expression;
import net.sf.hibernate.expression.Order;
import net.sf.hibernate.type.Type;

/** * This class has been automatically generated by Hibernate Synchronizer. * For more information or documentation, visit The Hibernate Synchronizer page * at http://www.binamics.com/hibernatesync or contact Joe Hudson at joe@binamics.com. */public abstract class _BaseRootDAO {

	protected static Map sessionFactoryMap = new HashMap();
	protected static ThreadLocal threadedSessions = new ThreadLocal();

	/**
	 * Configure the session factory by reading hibernate config file
	 */
	public static void initialize () throws HibernateException {
		initialize((String) null);
	}
	
	/**
	 * Configure the session factory by reading hibernate config file
	 * @param configFileName the name of the configuration file
	 */
	public static void initialize (String configFileName) throws HibernateException {
		if (null == configFileName && sessionFactoryMap.size() > 0) return;
		else if (null != sessionFactoryMap.get(configFileName)) return;
		else {
			Configuration cfg = new Configuration();
			if (null == configFileName)
				cfg.configure();
			else
				cfg.configure(configFileName);
			setSessionFactory(configFileName, cfg.buildSessionFactory());
		}
	}

	/**
	 * Set the session factory
	 */
	protected static void setSessionFactory (SessionFactory sessionFactory) {
		setSessionFactory((String) null, sessionFactory);
	}

	/**
	 * Set the session factory
	 */
	protected static void setSessionFactory (String configFileName, SessionFactory sessionFactory) {
		sessionFactoryMap.put(configFileName, sessionFactory);
	}

	/**
	 * Return the SessionFactory that is to be used by these DAOs.  Change this
	 * and implement your own strategy if you, for example, want to pull the SessionFactory
	 * from the JNDI tree.
	 */
	protected SessionFactory getSessionFactory() throws HibernateException {
		return getSessionFactory (getConfigurationFileName());
	}

	private static SessionFactory getSessionFactory(String configFile) throws HibernateException {
		if (sessionFactoryMap.size() == 1) return (SessionFactory) sessionFactoryMap.values().toArray()[0];
		else {
    		SessionFactory sessionFactory = (SessionFactory) sessionFactoryMap.get(configFile);
    		if (null == sessionFactory)
    			if (null == configFile)
    				throw new RuntimeException("The session factory has not been initialized.");
    			else
    				throw new RuntimeException("The session factory for '" + configFile + "' has not been initialized.");
    		else
    			return sessionFactory;
		}
	}

	/**
	 * Return a new Session object that must be closed when the work has been completed.
	 * @return the active Session
	 */
	protected Session getSession() throws HibernateException {
		return createSession();
	}

	/**
	 * Return a new Session object that must be closed when the work has been completed.
	 * @return the active Session
	 */
	public static Session createSession() throws HibernateException {
		return createSession(null);
	}

	/**
	 * Return a new Session object that must be closed when the work has been completed.
	 * @param configFile the config file must match the meta attribute "config-file" in the hibernate mapping file
	 * @return the active Session
	 */
	public static Session createSession(String configFile) throws HibernateException {
		java.util.Stack sessionStack = (java.util.Stack) threadedSessions.get();
		Session session = null;
		if (null == sessionStack) {
			sessionStack = new java.util.Stack();
			threadedSessions.set(sessionStack);
		}
		if (sessionStack.size() > 0) {
			Object[] arr = (Object[]) sessionStack.peek();
			String cf = (String) arr[0];
			if (null == cf) {
				session = (Session) arr[1];
			}
			else if (null != cf && null != configFile) {
				if (cf.equals(configFile)) session = (Session) arr[1];
			}
			if (null == session) {
				ForumInterceptor forumInterceptor = new ForumInterceptor();
				session = getSessionFactory(configFile).openSession(forumInterceptor);
				forumInterceptor.setSession(session);
				
				arr = new Object[2];
				arr[0] = configFile;
				arr[1] = session;
				sessionStack.push(arr);
			}
		}
		else {
			ForumInterceptor forumInterceptor = new ForumInterceptor();
			session = getSessionFactory(configFile).openSession(forumInterceptor);
			forumInterceptor.setSession(session);
			Object[] arr = new Object[2];
			arr = new Object[2];
			arr[0] = configFile;
			arr[1] = session;
			sessionStack.push(arr);
		}
		return session;

	}
	
	/**
	 * Return the name of the configuration file to be used with this DAO or null if default
	 */
	public String getConfigurationFileName () {
		return null;
	}

	/**
	 * Return the specific Object class that will be used for class-specific
	 * implementation of this DAO.
	 * @return the reference Class
	 */
	protected abstract Class getReferenceClass();

	/**
	 * Close the session
	 */
	public  void closeSession () throws HibernateException {
		java.util.Stack sessionStack = (java.util.Stack) threadedSessions.get();
		if (null != sessionStack) {
			Object[] arr = (Object[]) sessionStack.peek();
			String cf = (String) arr[0];
			if (null == cf) {
				Session session = (Session) arr[1];
				session.close();
				sessionStack.pop();
			}
			else {
				String configurationFile = getConfigurationFileName();
				if (null != configurationFile && configurationFile.equals(cf)) {
					Session session = (Session) arr[1];
					session.close();
					sessionStack.pop();
				}
			}
		}
	}

	/**
	 * Begin the transaction related to the session
	 */
	public Transaction beginTransaction(Session s) throws HibernateException {
		return s.beginTransaction();
	}

	/**
	 * Commit the given transaction
	 */
	public void commitTransaction(Transaction t) throws HibernateException {
		t.commit();
	}

	/**
	 * Execute a query. 
	 * @param query a query expressed in Hibernate's query language
	 * @return a distinct list of instances (or arrays of instances)
	 */
	public java.util.List find(String query) throws HibernateException {
		Session s = null;
//		try {
			s = getSession();
			return find(query, s);
//		} finally {
//			closeSession();
//		}
	}

	/**
	 * Perform a find but use the session given instead of creating a new one.
	 * @param query a query expressed in Hibernate's query language
	 * @s the Session to use
	 */
	public java.util.List find(String query, Session s) throws HibernateException {
		return s.find(query);
	}

	/**
	 * Return all objects related to the implementation of this DAO with no filter.
	 */
	public java.util.List findAll () throws HibernateException {
		Session s = null;
//		try {
			s = getSession();
    		return findAll(s);
//		}
//		finally {
//			closeSession();
//		}
	}

	/**
	 * Return all objects related to the implementation of this DAO with no filter.
	 * Use the session given.
	 * @param s the Session
	 */
	public java.util.List findAll (Session s) throws HibernateException {
   		return findAll(s, getDefaultOrderProperty());
	}

	/**
	 * Return all objects related to the implementation of this DAO with no filter.
	 */
	public java.util.List findAll (String orderProperty) throws HibernateException {
		Session s = null;
//		try {
			s = getSession();
			return findAll(s, orderProperty);
//		}
//		finally {
//			closeSession();
//		}
	}

	/**
	 * Return all objects related to the implementation of this DAO with no filter.
	 * Use the session given.
	 * @param s the Session
	 */
	public java.util.List findAll (Session s, String orderProperty) throws HibernateException {
		Criteria crit = createCriteria(s);
		if (null != orderProperty) crit.addOrder(Order.asc(orderProperty));
		return crit.list();
	}

	/**
	 * Return all objects related to the implementation of this DAO with a filter.
	 * Use the session given.
	 * @param propName the name of the property to use for filtering
	 * @param filter the value of the filter
	 */
	protected java.util.List findFiltered (String propName, Object filter) throws HibernateException {
		return findFiltered(propName, filter, getDefaultOrderProperty());
	}

	/**
	 * Return all objects related to the implementation of this DAO with a filter.
	 * Use the session given.
	 * @param propName the name of the property to use for filtering
	 * @param filter the value of the filter
	 * @param orderProperty the name of the property used for ordering
	 */
	protected java.util.List findFiltered (String propName, Object filter, String orderProperty) throws HibernateException {
		Session s = null;
//		try {
			s = getSession();
			return findFiltered(s, propName, filter, getDefaultOrderProperty());
//		}
//		finally {
//			closeSession();
//		}
	}
	
	/**
	 * Return all objects related to the implementation of this DAO with a filter.
	 * Use the session given.
	 * @param s the Session
	 * @param propName the name of the property to use for filtering
	 * @param filter the value of the filter
	 * @param orderProperty the name of the property used for ordering
	 */
	protected java.util.List findFiltered (Session s, String propName, Object filter, String orderProperty) throws HibernateException {
		Criteria crit = createCriteria(s);
		crit.add(Expression.eq(propName, filter));
		if (null != orderProperty) crit.addOrder(Order.asc(orderProperty));
		return crit.list();
	}
	
	/**
	 * Obtain an instance of Query for a named query string defined in the mapping file.
	 * @param name the name of a query defined externally 
	 * @return Query
	 */
	public java.util.List getNamedQuery(String name) throws HibernateException {
		Session s = null;
//		try {
			s = getSession();
			return getNamedQuery(name, s);
//		} finally {
//			closeSession();
//		}
	}

	/**
	 * Obtain an instance of Query for a named query string defined in the mapping file.
	 * Use the session given.
	 * @param name the name of a query defined externally 
	 * @param s the Session
	 * @return Query
	 */
	public java.util.List getNamedQuery(String name, Session s) throws HibernateException {
		Query q = s.getNamedQuery(name);
		return q.list();
	}

	/**
	 * Obtain an instance of Query for a named query string defined in the mapping file.
	 * Use the parameters given.
	 * @param name the name of a query defined externally 
	 * @param params the parameter array
	 * @return Query
	 */
	public java.util.List getNamedQuery(String name, Serializable[] params)
		throws HibernateException {
		Session s = null;
//		try {
			s = getSession();
			return getNamedQuery(name, params, s);
//		} finally {
//			closeSession();
//		}
	}

	/**
	 * Obtain an instance of Query for a named query string defined in the mapping file.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲柠檬福利资源导航| 欧美性一二三区| 中文字幕亚洲电影| 国产成人8x视频一区二区| 26uuu亚洲| av动漫一区二区| 亚洲一区在线观看免费观看电影高清 | 精彩视频一区二区| 中文字幕中文字幕一区| 91在线视频免费观看| 国产精品福利一区二区三区| 91激情五月电影| 日韩电影一区二区三区四区| 久久久久88色偷偷免费| 欧美专区日韩专区| 国产成人精品免费一区二区| 亚洲一二三四在线| 久久精品免费在线观看| 欧美性淫爽ww久久久久无| 国产九色sp调教91| 精品亚洲国内自在自线福利| 久久久久国产精品麻豆| 欧美美女直播网站| 成人免费视频视频在线观看免费| 亚洲黄色免费网站| 欧美激情一区二区三区不卡| 欧美日韩在线三区| 成人国产精品免费| 国内精品写真在线观看| 亚洲第一激情av| 亚洲人成人一区二区在线观看| 久久久久久夜精品精品免费| 日韩欧美亚洲另类制服综合在线| 色婷婷久久一区二区三区麻豆| 一区二区三区欧美| 成人app在线观看| 麻豆freexxxx性91精品| √…a在线天堂一区| 中文字幕亚洲不卡| 精品国产sm最大网站免费看| 欧美日韩在线亚洲一区蜜芽| 色综合天天视频在线观看| 制服丝袜日韩国产| 成+人+亚洲+综合天堂| 国产精品羞羞答答xxdd| 久草中文综合在线| 国产精品国产三级国产有无不卡 | 国产麻豆精品在线| 国产激情精品久久久第一区二区| 国产精品一区2区| 高清beeg欧美| 欧美在线观看视频一区二区| 欧美日韩高清一区二区| 日韩欧美一区在线| 欧美tickling挠脚心丨vk| 久久色成人在线| 国产精品美女久久久久久久久久久 | 一区二区在线观看免费视频播放| 亚洲人成网站影音先锋播放| 亚洲成a人在线观看| 国产一区二区在线看| 91麻豆免费视频| 日韩欧美一级二级| 17c精品麻豆一区二区免费| 日日摸夜夜添夜夜添亚洲女人| 成人午夜av电影| 欧美一级免费观看| 亚洲欧美综合网| 狠狠色狠狠色综合系列| 欧洲精品在线观看| 国产午夜亚洲精品羞羞网站| 亚洲bt欧美bt精品777| 成人高清视频免费观看| 久久久亚洲午夜电影| 亚洲第一主播视频| 色诱视频网站一区| 国产精品久久午夜夜伦鲁鲁| 美女视频一区二区三区| 在线视频亚洲一区| 一二三区精品福利视频| www.日本不卡| 日本一区二区三区久久久久久久久不| 欧美xxxxx裸体时装秀| 国产精品久久久久桃色tv| 日日夜夜一区二区| 欧美精品三级在线观看| 亚洲天天做日日做天天谢日日欢 | 91小视频在线免费看| 国产精品国产自产拍在线| 国产成人无遮挡在线视频| 精品成人在线观看| 国产美女精品人人做人人爽| 亚洲图片欧美视频| 欧美日韩在线播放一区| 国产欧美日韩麻豆91| 国产成人av自拍| 欧美精品777| 亚洲线精品一区二区三区| 国产欧美精品区一区二区三区| 一本色道久久加勒比精品| 在线成人小视频| 蜜桃精品视频在线| 日韩毛片一二三区| 久久久久9999亚洲精品| 日韩一级高清毛片| 91九色02白丝porn| 不卡高清视频专区| 国产在线不卡一区| 国产一区二区视频在线播放| 日日夜夜一区二区| 日韩在线卡一卡二| 亚洲欧美电影一区二区| 日韩电影在线免费看| 欧美一区二区三区免费在线看| 激情欧美一区二区三区在线观看| 欧美国产精品v| 欧美日韩中文精品| 极品少妇xxxx偷拍精品少妇| 中文字幕日韩一区| 亚洲人一二三区| 欧美色涩在线第一页| 久久精品久久精品| 亚洲午夜电影在线观看| 日本一区二区三区国色天香 | 337p日本欧洲亚洲大胆精品| 91丨porny丨首页| 国产剧情在线观看一区二区| 亚洲制服丝袜在线| 中文字幕一区二区三区蜜月 | 国产精品三级电影| 26uuu精品一区二区三区四区在线| 欧美性猛交xxxx乱大交退制版 | 99国产精品久久久久久久久久| 久久不见久久见免费视频7| 亚洲自拍另类综合| 伊人夜夜躁av伊人久久| 亚洲国产精品成人久久综合一区| 日韩欧美国产精品| 欧美国产综合一区二区| 国产精品第一页第二页第三页| 国产精品乱子久久久久| 亚洲综合免费观看高清完整版 | 日韩精品成人一区二区三区| 日韩二区三区四区| 丁香六月久久综合狠狠色| 色综合中文字幕| 在线电影国产精品| 国产欧美视频一区二区| 一区二区三区在线观看欧美| 日韩在线播放一区二区| 成人性生交大合| 欧美色综合影院| 国产精品入口麻豆九色| 日韩电影一区二区三区四区| 成人网页在线观看| 日韩精品一区二区三区在线| 中文字幕中文字幕在线一区| 日韩av午夜在线观看| av一本久道久久综合久久鬼色| 777亚洲妇女| 亚洲国产毛片aaaaa无费看| 看电影不卡的网站| 欧美日韩国产综合草草| 国产精品网站导航| 麻豆国产欧美日韩综合精品二区| 91视视频在线观看入口直接观看www | 三级精品在线观看| 一本一道波多野结衣一区二区| www激情久久| 欧美电影在线免费观看| 亚洲少妇中出一区| 国产成人精品网址| 精品国产一区久久| 国内精品视频666| 中文字幕欧美激情| 91色.com| 日韩激情一二三区| 久久久亚洲精品一区二区三区| 国产黄色精品网站| 中文字幕一区二区三区在线观看| 国产日韩精品一区二区三区 | 亚洲国产成人私人影院tom| 精品一二三四区| 成人欧美一区二区三区白人| 欧美日韩久久久一区| 日韩一区二区免费高清| 亚洲第一主播视频| 狠狠色狠狠色综合系列| 极品少妇xxxx精品少妇| 欧美一区永久视频免费观看| 久久亚洲精品国产精品紫薇| 午夜伦理一区二区| 99久久久精品| 亚洲国产精品自拍| 欧美成人精品福利| www.日韩精品| 国内精品嫩模私拍在线| 一区二区三区四区在线| 久久久91精品国产一区二区精品| 91在线精品秘密一区二区|