當前位置: 首頁>>代碼示例>>Java>>正文


Java Restrictions.conjunction方法代碼示例

本文整理匯總了Java中org.hibernate.criterion.Restrictions.conjunction方法的典型用法代碼示例。如果您正苦於以下問題:Java Restrictions.conjunction方法的具體用法?Java Restrictions.conjunction怎麽用?Java Restrictions.conjunction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.criterion.Restrictions的用法示例。


在下文中一共展示了Restrictions.conjunction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildCriterions

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
private void buildCriterions(Collection<com.bstek.dorado.data.provider.Criterion> criterions, DetachedCriteria dc) {
	for (com.bstek.dorado.data.provider.Criterion c : criterions) {
		if (c instanceof SingleValueFilterCriterion) {
			SingleValueFilterCriterion fc = (SingleValueFilterCriterion) c;
			dc.add(this.buildCriterion(fc));
		}
		if (c instanceof Junction) {
			Junction jun = (Junction) c;
			org.hibernate.criterion.Junction junction = null;
			if (jun instanceof Or) {
				junction = Restrictions.disjunction();
			} else if (jun instanceof And) {
				junction = Restrictions.conjunction();
			}
			Collection<com.bstek.dorado.data.provider.Criterion> subCriterions = jun.getCriterions();
			if (subCriterions != null) {
				buildCriterions(subCriterions, junction);
			}
			dc.add(junction);
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:23,代碼來源:HibernateDao.java

示例2: findMatchingName

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
/**
 * Search staff list for instructors with matching names
 * @param fname First Name 
 * @param lname Last Name
 * @return
 */
public static List findMatchingName(String fname, String lname) {
	List list = null;
    
	if ( (fname==null || fname.trim().length()==0) 
	        && (lname==null || lname.trim().length()==0) )
	    return list;
	
	Conjunction and = Restrictions.conjunction();
	if (fname!=null && fname.trim().length()>0)
	    and.add(Restrictions.ilike("firstName", fname, MatchMode.START));
	if (lname!=null && lname.trim().length()>0)
	    and.add(Restrictions.ilike("lastName", lname, MatchMode.START));
	
	StaffDAO sdao = new StaffDAO();
	list = sdao.getSession()
				.createCriteria(Staff.class)	
				.add(and)	
				.list();

	Collections.sort(list);
	
	return list;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:30,代碼來源:Staff.java

示例3: buildCriterions

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
private void buildCriterions(Collection<com.bstek.dorado.data.provider.Criterion> criterions,DetachedCriteria dc){
	for(com.bstek.dorado.data.provider.Criterion c : criterions){
		if (c instanceof SingleValueFilterCriterion){
			SingleValueFilterCriterion fc = (SingleValueFilterCriterion) c;
			dc.add(this.buildCriterion(fc));
		}
		if (c instanceof Junction) {
			Junction jun = (Junction) c;
			org.hibernate.criterion.Junction junction = null;
			if (jun instanceof Or) {
				junction = Restrictions.disjunction();
			} else if (jun instanceof And) {
				junction = Restrictions.conjunction();
			}
			Collection<com.bstek.dorado.data.provider.Criterion> subCriterions = jun.getCriterions();
			if (subCriterions != null) {
				buildCriterions(subCriterions, junction);
			}
			dc.add(junction);
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:23,代碼來源:HibernateDao.java


注:本文中的org.hibernate.criterion.Restrictions.conjunction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。