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


Java Criteria类代码示例

本文整理汇总了Java中net.sf.hibernate.Criteria的典型用法代码示例。如果您正苦于以下问题:Java Criteria类的具体用法?Java Criteria怎么用?Java Criteria使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Criteria类属于net.sf.hibernate包,在下文中一共展示了Criteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CriteriaImpl

import net.sf.hibernate.Criteria; //导入依赖的package包/类
/** 
 * Copy all the internal attributes of the given CrtieriaImpl
 * except alter the root persistent class type to be the given one.
 */
public CriteriaImpl(Class persistentClass, CriteriaImpl original) {
	this.persistentClass = persistentClass;

	this.classByAlias = original.classByAlias;
	this.classByAlias.put(Criteria.ROOT_ALIAS, persistentClass);
	
	this.criteria = original.criteria;
	this.orderings = original.orderings;
	this.fetchModes = original.fetchModes;
	this.associationPathByAlias = original.associationPathByAlias;
	this.aliasByAssociationPath = original.aliasByAssociationPath;
	this.lockModes = original.lockModes;
	this.maxResults = original.maxResults;
	this.firstResult = original.firstResult;
	this.timeout = original.timeout;
	this.fetchSize = original.fetchSize;
	this.session = original.session;
	this.resultTransformer = original.resultTransformer;
	this.counter = original.counter;
	this.cacheable = original.cacheable;
	this.cacheRegion = original.cacheRegion;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:CriteriaImpl.java

示例2: listarLogGestorDocumentalErrores

import net.sf.hibernate.Criteria; //导入依赖的package包/类
/**
 * @ejb.interface-method
 * @ejb.permission role-name="${role.admin}"
 * @ejb.permission role-name="${role.operador}"
 */
public List listarLogGestorDocumentalErrores(Date startDate, Date endDate, String idUsuario) {
    Session session = getSession();
    try {              	
    	Criteria criteria = session.createCriteria(LogGestorDocumentalError.class);
    	if (startDate != null) {
    		criteria.add(Expression.ge("fecha",startDate));
    	}
    	if (endDate != null) {
    		criteria.add(Expression.le("fecha",endDate));
    	}
    	if (idUsuario != null){
    		criteria.add(Expression.eq("usuarioSeycon",idUsuario));
    	}
    	List results = criteria.list();
        return results;
    } catch (HibernateException he) {
        throw new EJBException(he);
    } finally {
        close(session);
    }
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:27,代码来源:LogGestorDocumentalErroresFacadeEJB.java

示例3: listarLogOperaciones

import net.sf.hibernate.Criteria; //导入依赖的package包/类
/**
 * @ejb.interface-method
 * @ejb.permission role-name="${role.admin}"
 * @ejb.permission role-name="${role.operador}"
 */
public List listarLogOperaciones(Date startDate, Date endDate, String idUsuario, String idTipoOperacion) {
    Session session = getSession();
    try {              	
    	Criteria criteria = session.createCriteria(LogOperacion.class);
    	if (startDate != null) {
    		criteria.add(Expression.ge("fecha",startDate));
    	}
    	if (endDate != null) {
    		criteria.add(Expression.le("fecha",endDate));
    	}
    	if (idUsuario != null){
    		criteria.add(Expression.eq("usuarioSeycon",idUsuario));
    	}
    	if (idTipoOperacion != null){
    		TipoOperacion tipoOperacion = (TipoOperacion) session.load(TipoOperacion.class,idTipoOperacion);	        	  	
        	criteria.add(Expression.eq("tipoOperacion",tipoOperacion));
    	}
    	List results = criteria.list();
        return results;
    } catch (HibernateException he) {
        throw new EJBException(he);
    } finally {
        close(session);
    }
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:31,代码来源:LogOperacionFacadeEJB.java

示例4: getObjects

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public List getObjects(Object obj) throws ApplicationException{
 	Session s = null;
 	List list = null;
 	try {
	s = sf.openSession();
	Criteria c = s.createCriteria(obj.getClass());
	c.add(Example.create(obj));
	 list = c.list();
} catch (Exception ex){
	log.error(ex);
	if (log.isDebugEnabled())
		log	.debug("getObjects|Failure|Error in getting objects"+ ex.getMessage());
	
	throw new ApplicationException("An error occured in getting objects" + "\n" + ex.getMessage());
}finally {
	try {
		s.close();
	} catch (Exception ex2) {
		if (log.isDebugEnabled())
			log.debug("getObjects|Failure|Error in Closing Session |"	+ ex2.getMessage());
	}
} 
if (log.isDebugEnabled())
	log	.debug("getObjects|Success|Successful in deleting the "+ obj.getClass().getName());
 	return list;
 }
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:27,代码来源:HibernateDAO.java

示例5: getObjects

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public List getObjects(Object obj) {
 	Session s = null;
 	List list = null;
 	try {
	s = sf.openSession();
	Criteria c = s.createCriteria(obj.getClass());
	c.add(Example.create(obj));
	 list = c.list();
} catch (Exception ex){
	ex.printStackTrace();
	
}finally {
	try {
		s.close();
	} catch (Exception ex2) {
		ex2.printStackTrace();
	}
} 

 	return list;
 }
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:22,代码来源:HibernateDAO.java

示例6: getObjects

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public List getObjects(Object obj) throws ApplicationException{
 	Session s = null;
 	List list = null;
 	try {
	s = sf.openSession();
	Criteria c = s.createCriteria(obj.getClass());
	c.add(Example.create(obj));
	 list = c.list();
} catch (Exception ex){
	log.error(ex);
	if (log.isDebugEnabled())
		log	.debug("getObjects|Failure|Error in getting objects"+ ex.getMessage());
	
	throw new ApplicationException("An error occured in getting objects" + "\n" + ex.getMessage(), ex);
}finally {
	try {
		s.close();
	} catch (Exception ex2) {
		if (log.isDebugEnabled())
			log.debug("getObjects|Failure|Error in Closing Session |"	+ ex2.getMessage());
	}
} 
if (log.isDebugEnabled())
	log	.debug("getObjects|Success|Successful in deleting the "+ obj.getClass().getName());
 	return list;
 }
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:27,代码来源:HibernateDAO.java

示例7: createCriteriaAt

import net.sf.hibernate.Criteria; //导入依赖的package包/类
private Criteria createCriteriaAt(String rootAlias, String associationPath, String alias)  throws HibernateException {
	String testAlias = StringHelper.root(associationPath);
	if ( classByAlias.containsKey(testAlias) ) {
		rootAlias = testAlias;
		associationPath = associationPath.substring( rootAlias.length() + 1 );
	}

	createAlias(rootAlias, associationPath, alias);
	return new Subcriteria(alias, associationPath);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:CriteriaImpl.java

示例8: Page

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public Page( Criteria criteria, int page, int pageSize ) throws HibernateException
{
	this.page = page;
	this.pageSize = pageSize;
			
	 results = criteria.setFirstResult(page * pageSize)
	.setMaxResults(pageSize+1)
       .list();        	
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:10,代码来源:Page.java

示例9: listarPaletas

import net.sf.hibernate.Criteria; //导入依赖的package包/类
/**
 * @ejb.interface-method
 * @ejb.permission role-name="${role.admin},${role.operador}"
 */
public List/*Paleta*/ listarPaletas() {
    Session session = getSession();
    try {
        Criteria criteri = session.createCriteria(Paleta.class);
        criteri.setCacheable(true);
        return criteri.list();
    } catch (HibernateException he) {
        throw new EJBException(he);
    } finally {
        close(session);
    }
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:17,代码来源:PaletaFacadeEJB.java

示例10: generateRootAlias

import net.sf.hibernate.Criteria; //导入依赖的package包/类
protected String generateRootAlias(String tableName) {
	return Criteria.ROOT_ALIAS;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:CriteriaLoader.java

示例11: createCriteria

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public Criteria createCriteria(final Class persistentClass) {
	return getSession().createCriteria(persistentClass);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:JCASessionImpl.java

示例12: createCriteria

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public Criteria createCriteria(Class persistentClass) {
	return new CriteriaImpl(persistentClass, this);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:SessionImpl.java

示例13: add

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public Criteria add(Criterion expression) {
	CriteriaImpl.this.add(rootAlias, expression);
	return this;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:CriteriaImpl.java

示例14: createAlias

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public Criteria createAlias(String associationPath, String alias)
	throws HibernateException {
	CriteriaImpl.this.createAlias(rootAlias, associationPath, alias);
	return this;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:6,代码来源:CriteriaImpl.java

示例15: addOrder

import net.sf.hibernate.Criteria; //导入依赖的package包/类
public Criteria addOrder(Order order) {
	throw new UnsupportedOperationException("subcriteria cannot be ordered");
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:CriteriaImpl.java


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