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


Java Example.create方法代碼示例

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


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

示例1: getByMarketApp

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
public CatalogConvertor getByMarketApp(Session sess, String marketName, short catalog, int subCatalog) {
    Criteria cri = sess.createCriteria(CatalogConvertor.class);
    CatalogConvertor catalogConvertor = new CatalogConvertor();
    catalogConvertor.setMarketName(marketName);
    catalogConvertor.setCatalog(catalog);
    catalogConvertor.setSubCatalog(subCatalog);
    Example example = Example.create(catalogConvertor);
    example.excludeZeroes();
    cri.add(example);

    Object o = cri.uniqueResult();
    if (o != null) {
        catalogConvertor = (CatalogConvertor) o;
    }
    return catalogConvertor;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:18,代碼來源:CatalogConvertorDaoImpl.java

示例2: 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

示例3: findByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public List<T> findByExample(T exampleInstance, String... excludeProperty) {
	try {
		Criteria crit = getSession().createCriteria(getPersistentClass());
		Example example = Example.create(exampleInstance);
		for (String exclude : excludeProperty) {
			example.excludeProperty(exclude);
		}
		crit.add(example);
		return crit.list();
	} catch (Exception e) {
		// e.printStackTrace();
		getTransaction().rollback();
		return null;
	}
}
 
開發者ID:schogini,項目名稱:jVoiD,代碼行數:18,代碼來源:GenericHibernateDAO.java

示例4: findByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
/**
 * @param <T>
 * @param exampleInstance
 * @param excludeZeros
 * @param excludeProperty
 * @return
 * @see edu.utah.further.core.api.data.Dao#findByExample(edu.utah.further.core.api.data.PersistentEntity,
 *      boolean, java.lang.String[])
 */
@Override
public <T extends PersistentEntity<?>> List<T> findByExample(final T exampleInstance,
		final boolean excludeZeros, final String... excludeProperty)
{
	final GenericCriteria crit = createCriteria(exampleInstance.getClass());
	final Example example = Example.create(exampleInstance);
	if (excludeZeros)
	{
		example.excludeZeroes();
	}
	for (final String exclude : excludeProperty)
	{
		example.excludeProperty(exclude);
	}
	crit.add(example);
	return getNullSafeList(crit.<T> list());
}
 
開發者ID:openfurther,項目名稱:further-open-core,代碼行數:27,代碼來源:DaoHibernateImpl.java

示例5: findByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
/**
 * @see GenericDao#findByExample(Object, String...)
 */
@SuppressWarnings("unchecked")
public List<T> findByExample(T exampleInstance, String... excludeProperty)
      throws DataAccessException {
   try {
      Criteria crit = getSession().createCriteria(getPersistentClass());
      Example example = Example.create(exampleInstance);
      for (String exclude : excludeProperty) {
         example.excludeProperty(exclude);
      }
      crit.add(example);
      return crit.list();
   } catch (HibernateException e) {
      throw SessionFactoryUtils.convertHibernateAccessException(e);
   }
}
 
開發者ID:kumaramit01,項目名稱:FlowService,代碼行數:19,代碼來源:GenericDaoImpl.java

示例6: 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

示例7: search

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
public List<?> search(Admin admin) {
	Session session = sessionFactory.getCurrentSession();
	Criteria c = session.createCriteria(Admin.class);
	
	// 創建示例條件
	Example example = Example.create(admin);
	c.add(example);
	return c.list();
}
 
開發者ID:RyougiChan,項目名稱:NewsSystem,代碼行數:11,代碼來源:AdminDAOImpl.java

示例8: allowAccess

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
public boolean allowAccess(String marketName, String key) {
    Criteria cri = getSession().createCriteria(Market.class);
    Market entity = new Market();
    entity.setMarketName(marketName);
    entity.setAllowAccessKey(key);
    Example exa = Example.create(entity);
    exa.excludeZeroes();
    cri.add(exa);
    return cri.uniqueResult() != null;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:12,代碼來源:MarketDaoImpl.java

示例9: findByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
public List<?> findByExample(Object entity) {
	Example example = Example.create( entity );
	example.enableLike(MatchMode.ANYWHERE);
	Criteria criteria = getCurrentSession().createCriteria( entity.getClass() );
	criteria.add( example );
	return criteria.add(example).list();
}
 
開發者ID:hserv,項目名稱:coordinated-entry,代碼行數:8,代碼來源:QueryExecutorImpl.java

示例10: createIterator

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
protected Iterator createIterator() {
    session = sessionFactory.openSession();
    transaction = session.beginTransaction();
    Example example = Example.create(template);
    Criteria criteria = session.createCriteria(template.getClass()).add(example);
    criteria.setCacheMode(CacheMode.IGNORE);
    criteria.setCacheable(false);
    criteria.setFlushMode(FlushMode.NEVER);
    return criteria.list().iterator();
}
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:11,代碼來源:DefaultCriteriaByExampleDataIterator.java

示例11: findByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public List<T> findByExample(T exampleInstance, String[] excludeProperty) {
	Criteria crit = getSession().createCriteria(getPersistentClass());
	Example example =  Example.create(exampleInstance);
	for (String exclude : excludeProperty) {
	    example.excludeProperty(exclude);
	}
	crit.add(example);
	return crit.list();
}
 
開發者ID:giuseppeurso-eu,項目名稱:struts-mvc,代碼行數:11,代碼來源:GenericHibernateDAO.java

示例12: findByExample

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
@SuppressWarnings({"unchecked"})
public List<T> findByExample(T exampleInstance, String... excludeProperty) {
    Criteria crit = getSession().createCriteria(getPersistentClass());
    Example example = Example.create(exampleInstance);
    for (String exclude : excludeProperty) {
        example.excludeProperty(exclude);
    }
    crit.add(example);
    return crit.list();
}
 
開發者ID:alfameCom,項目名稱:salasanasiilo,代碼行數:12,代碼來源:GenericHibernateDAO.java

示例13: 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

示例14: find

import org.hibernate.criterion.Example; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public List<ISoapBoxEntity> find(ISoapBoxEntity entity) {
	EntityManager manager = ConnectionDB.getManager();
	manager.clear();
	Session sessao = (Session) manager.getDelegate();
	Example example = Example.create(entity);
	example.excludeZeroes();
	Criteria criteria = sessao.createCriteria(entity.getClass());
	criteria.add(example);
	return criteria.list();
}
 
開發者ID:nilzao,項目名稱:soapbox-race,代碼行數:13,代碼來源:SoapboxDao.java

示例15: 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


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