当前位置: 首页>>代码示例>>Java>>正文


Java Example.excludeZeroes方法代码示例

本文整理汇总了Java中org.hibernate.criterion.Example.excludeZeroes方法的典型用法代码示例。如果您正苦于以下问题:Java Example.excludeZeroes方法的具体用法?Java Example.excludeZeroes怎么用?Java Example.excludeZeroes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.criterion.Example的用法示例。


在下文中一共展示了Example.excludeZeroes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

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

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

示例7: createExample

import org.hibernate.criterion.Example; //导入方法依赖的package包/类
Criterion createExample(Object entity, MatchMode matchMode, boolean excludeNulls, boolean excludeZeroes,
        Collection<String> excludeProperties) {
    final Example example = Example.create(entity).enableLike(matchMode).ignoreCase();
    if (excludeZeroes) {
        example.excludeZeroes();
    } else if (!excludeNulls) {
        example.excludeNone();
    }
    for (final String property : excludeProperties) {
        example.excludeProperty(property);
    }

    // ID property is not handled by Example, so we have to special case it
    final PersistentClass pclass = getClassMapping(entity.getClass());
    Object idVal = null;
    if (pclass != null && pclass.hasIdentifierProperty()) {
        try {
            idVal = PropertyUtils.getProperty(entity, pclass.getIdentifierProperty().getName());
        } catch (final Exception e) {
            LOG.warn("Could not retrieve identifier value in a by example query, ignoring it", e);
        }
    }
    if (idVal == null) {
        return example;
    } else {
        return Restrictions.and(Restrictions.idEq(idVal), example);
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:29,代码来源:AbstractCaArrayDaoImpl.java


注:本文中的org.hibernate.criterion.Example.excludeZeroes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。