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

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

?? example.java

?? 介紹了hibernate的入門有一些基本常用的事例
?? JAVA
字號:
//$Id: Example.java,v 1.19 2005/02/21 02:46:40 oneovthafew Exp $package org.hibernate.criterion;import java.util.ArrayList;import java.util.HashSet;import java.util.List;import java.util.Set;import org.hibernate.Criteria;import org.hibernate.EntityMode;import org.hibernate.HibernateException;import org.hibernate.engine.TypedValue;import org.hibernate.persister.entity.EntityPersister;import org.hibernate.type.AbstractComponentType;import org.hibernate.type.Type;import org.hibernate.util.StringHelper;/** * Support for query by example. * <pre> * List results = session.createCriteria(Parent.class) *     .add( Example.create(parent).ignoreCase() ) *     .createCriteria("child") *         .add( Example.create( parent.getChild() ) ) *     .list(); * </pre> * "Examples" may be mixed and matched with "Expressions" in the same <tt>Criteria</tt>. * @see org.hibernate.Criteria * @author Gavin King */public class Example implements Criterion {	private final Object entity;	private final Set excludedProperties = new HashSet();	private PropertySelector selector;	private boolean isLikeEnabled;	private boolean isIgnoreCaseEnabled;	private MatchMode matchMode;	/**	 * A strategy for choosing property values for inclusion in the query	 * criteria	 */	public static interface PropertySelector {		public boolean include(Object propertyValue, String propertyName, Type type);	}	private static final PropertySelector NOT_NULL = new NotNullPropertySelector();	private static final PropertySelector ALL = new AllPropertySelector();	private static final PropertySelector NOT_NULL_OR_ZERO = new NotNullOrZeroPropertySelector();	static final class AllPropertySelector implements PropertySelector {		public boolean include(Object object, String propertyName, Type type) {			return true;		}	}	static final class NotNullPropertySelector implements PropertySelector {		public boolean include(Object object, String propertyName, Type type) {			return object!=null;		}	}	static final class NotNullOrZeroPropertySelector implements PropertySelector {		public boolean include(Object object, String propertyName, Type type) {			return object!=null && (				!(object instanceof Number) || ( (Number) object ).longValue()!=0			);		}	}	/**	 * Set the property selector	 */	public Example setPropertySelector(PropertySelector selector) {		this.selector = selector;		return this;	}	/**	 * Exclude zero-valued properties	 */	public Example excludeZeroes() {		setPropertySelector(NOT_NULL_OR_ZERO);		return this;	}	/**	 * Don't exclude null or zero-valued properties	 */	public Example excludeNone() {		setPropertySelector(ALL);		return this;	}	/**	 * Use the "like" operator for all string-valued properties	 */	public Example enableLike(MatchMode matchMode) {		isLikeEnabled = true;		this.matchMode = matchMode;		return this;	}	/**	 * Use the "like" operator for all string-valued properties	 */	public Example enableLike() {		return enableLike(MatchMode.EXACT);	}	/**	 * Ignore case for all string-valued properties	 */	public Example ignoreCase() {		isIgnoreCaseEnabled = true;		return this;	}	/**	 * Exclude a particular named property	 */	public Example excludeProperty(String name) {		excludedProperties.add(name);		return this;	}	/**	 * Create a new instance, which includes all non-null properties	 * by default	 * @param entity	 * @return a new instance of <tt>Example</tt>	 */	public static Example create(Object entity) {		if (entity==null) throw new NullPointerException("null example");		return new Example(entity, NOT_NULL);	}	protected Example(Object entity, PropertySelector selector) {		this.entity = entity;		this.selector = selector;	}	public String toString() {		return "example (" + entity + ')';	}	private boolean isPropertyIncluded(Object value, String name, Type type) {		return !excludedProperties.contains(name) &&			!type.isAssociationType() &&			selector.include(value, name, type);	}	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)		throws HibernateException {		StringBuffer buf = new StringBuffer().append('(');		EntityPersister meta = criteriaQuery.getFactory().getEntityPersister( criteriaQuery.getEntityName(criteria) );		String[] propertyNames = meta.getPropertyNames();		Type[] propertyTypes = meta.getPropertyTypes();		//TODO: get all properties, not just the fetched ones!		Object[] propertyValues = meta.getPropertyValues( entity, getEntityMode(criteria, criteriaQuery) );		for (int i=0; i<propertyNames.length; i++) {			Object propertyValue = propertyValues[i];			String propertyName = propertyNames[i];			boolean isPropertyIncluded = i!=meta.getVersionProperty() &&				isPropertyIncluded( propertyValue, propertyName, propertyTypes[i] );			if (isPropertyIncluded) {				if ( propertyTypes[i].isComponentType() ) {					appendComponentCondition(						propertyName,						propertyValue,						(AbstractComponentType) propertyTypes[i],						criteria,						criteriaQuery,						buf					);				}				else {					appendPropertyCondition(						propertyName,						propertyValue,						criteria,						criteriaQuery,						buf					);				}			}		}		if ( buf.length()==1 ) buf.append("1=1"); //yuck!		return buf.append(')').toString();	}	private static final Object[] TYPED_VALUES = new TypedValue[0];	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)	throws HibernateException {		EntityPersister meta = criteriaQuery.getFactory()				.getEntityPersister( criteriaQuery.getEntityName(criteria) );		String[] propertyNames = meta.getPropertyNames();		Type[] propertyTypes = meta.getPropertyTypes();		 //TODO: get all properties, not just the fetched ones!		Object[] values = meta.getPropertyValues( entity, getEntityMode(criteria, criteriaQuery) );		List list = new ArrayList();		for (int i=0; i<propertyNames.length; i++) {			Object value = values[i];			Type type = propertyTypes[i];			String name = propertyNames[i];			boolean isPropertyIncluded = i!=meta.getVersionProperty() &&				isPropertyIncluded(value, name, type);			if (isPropertyIncluded) {				if ( propertyTypes[i].isComponentType() ) {					addComponentTypedValues(name, value, (AbstractComponentType) type, list, criteria, criteriaQuery);				}				else {					addPropertyTypedValue(value, type, list);				}			}		}		return (TypedValue[]) list.toArray(TYPED_VALUES);	}		private EntityMode getEntityMode(Criteria criteria, CriteriaQuery criteriaQuery) {		EntityPersister meta = criteriaQuery.getFactory()				.getEntityPersister( criteriaQuery.getEntityName(criteria) );		EntityMode result = meta.guessEntityMode(entity);		if (result==null) {			throw new ClassCastException( entity.getClass().getName() );		}		return result;	}	protected void addPropertyTypedValue(Object value, Type type, List list) {		if ( value!=null ) {			if ( value instanceof String ) {				String string = (String) value;				if (isIgnoreCaseEnabled) string = string.toLowerCase();				if (isLikeEnabled) string = matchMode.toMatchString(string);				value = string;			}			list.add( new TypedValue(type, value, null) );		}	}	protected void addComponentTypedValues(			String path, 			Object component, 			AbstractComponentType type, 			List list, 			Criteria criteria, 			CriteriaQuery criteriaQuery)	throws HibernateException {		if (component!=null) {			String[] propertyNames = type.getPropertyNames();			Type[] subtypes = type.getSubtypes();			Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) );			for (int i=0; i<propertyNames.length; i++) {				Object value = values[i];				Type subtype = subtypes[i];				String subpath = StringHelper.qualify( path, propertyNames[i] );				if ( isPropertyIncluded(value, subpath, subtype) ) {					if ( subtype.isComponentType() ) {						addComponentTypedValues(subpath, value, (AbstractComponentType) subtype, list, criteria, criteriaQuery);					}					else {						addPropertyTypedValue(value, subtype, list);					}				}			}		}	}	protected void appendPropertyCondition(		String propertyName,		Object propertyValue,		Criteria criteria,		CriteriaQuery cq,		StringBuffer buf)	throws HibernateException {		Criterion crit;		if ( propertyValue!=null ) {			boolean isString = propertyValue instanceof String;			String op = isLikeEnabled && isString ? " like " : "=";			crit = new SimpleExpression( propertyName, propertyValue, op, isIgnoreCaseEnabled && isString );		}		else {			crit = new NullExpression(propertyName);		}		String critCondition = crit.toSqlString(criteria, cq);		if ( buf.length()>1 && critCondition.trim().length()>0 ) buf.append(" and ");		buf.append(critCondition);	}	protected void appendComponentCondition(		String path,		Object component,		AbstractComponentType type,		Criteria criteria,		CriteriaQuery criteriaQuery,		StringBuffer buf)	throws HibernateException {		if (component!=null) {			String[] propertyNames = type.getPropertyNames();			Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) );			Type[] subtypes = type.getSubtypes();			for (int i=0; i<propertyNames.length; i++) {				String subpath = StringHelper.qualify( path, propertyNames[i] );				Object value = values[i];				if ( isPropertyIncluded( value, subpath, subtypes[i] ) ) {					Type subtype = subtypes[i];					if ( subtype.isComponentType() ) {						appendComponentCondition(							subpath,							value,							(AbstractComponentType) subtype,							criteria,							criteriaQuery,							buf						);					}					else {						appendPropertyCondition(							subpath,							value,							criteria,							criteriaQuery,							buf						);					}				}			}		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丝袜a∨在线一区二区三区不卡| 国产精品五月天| 91丨九色丨国产丨porny| 国产精品一区在线观看乱码| 免费看日韩a级影片| 奇米综合一区二区三区精品视频| 亚洲一区二区三区四区的| 亚洲精品国产第一综合99久久| 1000部国产精品成人观看| 亚洲同性gay激情无套| 中文字幕欧美一| 亚洲综合一区在线| 婷婷中文字幕一区三区| 欧美aⅴ一区二区三区视频| 久久国产精品99久久人人澡| 精品亚洲成a人在线观看| 国产成人精品影视| 色老汉一区二区三区| 欧美三区在线视频| 日韩视频一区二区在线观看| 91精品国产色综合久久ai换脸 | 国产福利一区二区三区视频| 激情久久久久久久久久久久久久久久| 国产精品主播直播| 色婷婷香蕉在线一区二区| 欧美主播一区二区三区美女| 欧美男男青年gay1069videost | 3atv一区二区三区| www欧美成人18+| 亚洲婷婷国产精品电影人久久| 午夜伦欧美伦电影理论片| 极品美女销魂一区二区三区| 91视频观看视频| 制服丝袜在线91| 国产精品色一区二区三区| 亚洲一二三四在线观看| 国产精品123区| 欧美视频三区在线播放| 国产日韩在线不卡| 日本中文在线一区| 99精品国产热久久91蜜凸| 日韩色视频在线观看| 中文字幕亚洲区| 精品一区精品二区高清| 色嗨嗨av一区二区三区| 久久午夜色播影院免费高清| 一区二区三区加勒比av| 国产精品乡下勾搭老头1| 欧美日韩1234| 亚洲女人****多毛耸耸8| 国模套图日韩精品一区二区| 欧美性大战xxxxx久久久| 欧美韩日一区二区三区四区| 视频一区二区中文字幕| 91色在线porny| 国产午夜精品久久久久久久| 日韩av电影免费观看高清完整版 | 国产精品污网站| 久久国产精品99久久久久久老狼 | 国产资源在线一区| 91精品国产综合久久小美女| 亚洲男人的天堂在线aⅴ视频| 国产成人精品免费| 亚洲精品一区二区三区香蕉| 午夜电影久久久| 欧美亚洲综合网| 亚洲色图欧美在线| 91网址在线看| 中文字幕在线一区免费| 国产盗摄视频一区二区三区| 久久新电视剧免费观看| 国产一区二区中文字幕| 久久久美女毛片| 国产精品一二三| 国产三级精品视频| 97久久精品人人爽人人爽蜜臀| 国产日韩亚洲欧美综合| 成人黄色免费短视频| 国产精品伦理一区二区| 波多野结衣中文字幕一区二区三区| 久久久久久久精| zzijzzij亚洲日本少妇熟睡| 中文字幕在线不卡| 色综合天天在线| 一区二区三区波多野结衣在线观看 | 欧美亚洲动漫制服丝袜| 亚洲高清不卡在线观看| 欧美精品乱码久久久久久| 日韩av电影天堂| 久久综合五月天婷婷伊人| 国产伦精品一区二区三区免费| 久久免费偷拍视频| 99在线视频精品| 午夜影院久久久| 欧美电影免费观看高清完整版在 | 99国产欧美另类久久久精品| 亚洲伦理在线精品| 91精品国产乱| 国产高清久久久| 亚洲自拍偷拍网站| 日韩三级伦理片妻子的秘密按摩| 精品一区二区影视| 亚洲欧美色综合| 日韩欧美国产一区二区三区 | 色94色欧美sute亚洲线路一久| 亚洲综合另类小说| 日韩欧美一级二级三级| 粉嫩蜜臀av国产精品网站| 亚洲精品日韩综合观看成人91| 欧美性受xxxx| 国产夫妻精品视频| 五月综合激情网| 欧美国产禁国产网站cc| 欧美日韩国产片| 国产超碰在线一区| 午夜亚洲国产au精品一区二区| 精品日韩在线观看| 欧洲精品在线观看| 国产精品18久久久久久久久久久久 | 亚洲色图制服诱惑| 精品欧美一区二区三区精品久久 | 欧美一区国产二区| 99国产精品久久久久久久久久久| 日韩中文字幕亚洲一区二区va在线 | 麻豆91在线播放免费| 亚洲视频一区二区在线观看| 精品国产一区二区三区久久影院| 99re8在线精品视频免费播放| 老司机精品视频一区二区三区| 亚洲精品老司机| 国产精品亲子伦对白| 精品少妇一区二区三区在线视频| 欧美网站大全在线观看| 99精品一区二区三区| 国v精品久久久网| 精东粉嫩av免费一区二区三区| 亚洲国产sm捆绑调教视频| 中文字幕乱码一区二区免费| 日韩女同互慰一区二区| 欧美三级蜜桃2在线观看| eeuss影院一区二区三区 | 亚洲bt欧美bt精品| 亚洲视频在线一区观看| 中文字幕一区二区5566日韩| 久久男人中文字幕资源站| 久久尤物电影视频在线观看| 欧美挠脚心视频网站| 欧美三级电影网| 欧美日韩免费观看一区三区| 欧洲视频一区二区| 欧美日韩久久久| 欧美日韩国产经典色站一区二区三区| 色综合视频在线观看| 91福利在线导航| 在线看日韩精品电影| 欧美性生活大片视频| 91极品美女在线| 欧美日韩一区二区在线观看视频| 欧美怡红院视频| 欧美日韩高清在线| 69堂国产成人免费视频| 欧美精品在线观看一区二区| 欧美片在线播放| 日韩精品一区二区三区四区 | 久久久国际精品| 中文字幕中文在线不卡住| 自拍偷拍国产精品| 亚洲3atv精品一区二区三区| 日韩精品每日更新| 国产麻豆成人传媒免费观看| 成人美女视频在线看| 91久久香蕉国产日韩欧美9色| 欧美性猛交xxxx黑人交| 日韩一区二区免费在线观看| 精品99一区二区| 亚洲私人黄色宅男| 婷婷久久综合九色综合绿巨人| 免费在线观看精品| 粉嫩aⅴ一区二区三区四区五区| 99久久国产综合色|国产精品| 欧美日韩电影在线| 国产精品网站在线播放| 亚洲福利电影网| 国内成人免费视频| 欧美曰成人黄网| 精品国产a毛片| 亚洲美女偷拍久久| 久久成人精品无人区| 99视频一区二区三区| 91.成人天堂一区| 欧美国产欧美综合| 日本视频中文字幕一区二区三区| 国产精品自拍一区| 欧美日韩免费电影| 国产欧美日韩另类一区| 性做久久久久久免费观看| 成人午夜又粗又硬又大| 日韩午夜av电影| 一区二区在线观看免费| 国产精品一色哟哟哟|