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


Java Example.ignoreCase方法代碼示例

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


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

示例1: searchByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
public Page<Taxon> searchByExample(Taxon example, boolean ignoreCase,
		boolean useLike) {
	Example criterion = Example.create(example);
	if(ignoreCase) {
		criterion.ignoreCase();
	}
	if(useLike) {
		criterion.enableLike();
	}
	Criteria criteria = getSession().createCriteria(Taxon.class);
	criteria.add(criterion);
	List<Taxon> results = (List<Taxon>) criteria.list();
	Page<Taxon> page = new DefaultPageImpl<Taxon>(results.size(), null, null, results, null);
	return page;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:17,代碼來源:TaxonDaoImpl.java

示例2: getPeloExemplo

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
/**
 * Metodo para listar objetos semelhantes ao Object example
 * 
 * @param exemplo
 *            : objeto Example
 * @param isEnableLike
 *            : True se � para ativar o "Like" na consulta, false para
 *            desativar
 * @param isIgnoreCase
 *            : True se � para ignorar mai�sculas e min�sculas na consulta,
 *            false para case sensitive
 * */
@Transactional(readOnly = true, propagation = Propagation.REQUIRED)
public List getPeloExemplo(Object example, boolean isEnableLike,
		boolean isIgnoreCase) {

	Criteria criteria = this.sessionFactory.getCurrentSession()
			.createCriteria(example.getClass());
	Example sample = Example.create(example);
	if (isEnableLike)
		sample.enableLike(MatchMode.ANYWHERE);

	if (isIgnoreCase)
		sample.ignoreCase();

	sample.excludeZeroes();
	criteria.add(sample);
	return criteria.list();

}
 
開發者ID:LM25TTD,項目名稱:autotrack,代碼行數:31,代碼來源:GenericDao.java

示例3: searchByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
public Page<Taxon> searchByExample(Taxon example, boolean ignoreCase, boolean useLike) {
	Example criterion = Example.create(example);
	if(ignoreCase) {
		criterion.ignoreCase();
	}
	if(useLike) {
		criterion.enableLike();
	}
	Criteria criteria = getSession().createCriteria(Taxon.class);
	criteria.add(criterion);
	List<Taxon> results = (List<Taxon>) criteria.list();
	Page<Taxon> page = new DefaultPageImpl<Taxon>(results, 0, results.size());
	return page;
}
 
開發者ID:RBGKew,項目名稱:powop,代碼行數:15,代碼來源:TaxonDaoImpl.java

示例4: prepareCriteria

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
private Criteria prepareCriteria(T sample, String[] excludeProps, RelatedCriteria[] relations){
	Criteria result = null;
	
	if(sample == null){
		result = this.getCurrentSession().createCriteria(persistentClass);
	}else{		
		Example example = Example.create(sample);
		example.enableLike(MatchMode.ANYWHERE);
		example.ignoreCase();
		
		if(excludeProps != null)
			for(String prop : excludeProps)
				example.excludeProperty(prop);
		
		result = this.getCurrentSession().createCriteria(persistentClass);
		result.add(example);
		
		//Si existen objetos relacionados
		if(relations != null){
			for(RelatedCriteria relation : relations){
				if( (relation != null) && (relation.isValid()) ){
					
					//Se crea el ejemplo del objeto relacionado
					Example objectEx = Example.create(relation.getObject());
					objectEx.enableLike(MatchMode.ANYWHERE);
					objectEx.ignoreCase();
				
					//Se añade el join a la búsqueda
					result.createCriteria(relation.getName())
						.add(objectEx);
				}
			}
		}
	}
	
	return result;
}
 
開發者ID:malaguna,項目名稱:cmdit,代碼行數:38,代碼來源:BasicHibernateDAOImpl.java

示例5: generateWhere

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
protected Criteria generateWhere(final Where<T> where,
		@Nonnull final Map<String, String> alias, Criteria criteria) {

	if (where != null) {
		EntityExample<T> example = where.getExample();
		if (example != null && example.getEntity() != null) {
			Example ejemplo = Example.create(example.getEntity());
			ejemplo.enableLike(example.getMatchMode().getMatchMode());
			ejemplo.setEscapeCharacter('\\');
			if (example.isIgnoreCase()) {
				ejemplo.ignoreCase();
			}
			if (example.isExcludeZeroes()) {
				ejemplo.excludeZeroes();
			}
			criteria.add(ejemplo);
			if (example.getExcluded() != null) {
				for (String excluded : example.getExcluded()) {
					ejemplo.excludeProperty(excluded);
				}
			}
			this.configureExample(criteria, example.getEntity());
		}
		for (String s : where.getFetchs()) {
			criteria.setFetchMode(s, FetchMode.JOIN);
		}
		helper.applyClauses(criteria, where, alias);
	}

	return criteria;
}
 
開發者ID:fpuna-cia,項目名稱:karaku,代碼行數:32,代碼來源:BaseDAOImpl.java

示例6: listByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
public List listByExample(Object example) {
	HibernateUtility.getSession().clear();
	Criteria criteria = HibernateUtility.getSession().createCriteria( example.getClass() );
	Example sample = Example.create( example );		
	sample.enableLike(MatchMode.ANYWHERE);
	sample.ignoreCase();
	criteria.add( sample );
	return criteria.list();
}
 
開發者ID:herculeshssj,項目名稱:imobiliariaweb,代碼行數:11,代碼來源:HibernateGenericDao.java


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