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


Java Restrictions.eq方法代码示例

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


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

示例1: findByGroup

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
public Page<SurveyDirectory> findByGroup(String groupId1,String groupId2,Page<SurveyDirectory> page) {
	
	
	List<Criterion> criterions = new ArrayList<Criterion>();
	if(groupId1!=null && !"".equals(groupId1)){
		Criterion cri1=Restrictions.eq("groupId1", groupId1);
		criterions.add(cri1);
	}
	if(groupId2!=null && !"".equals(groupId2)){
		Criterion cri1_2=Restrictions.eq("groupId2", groupId2);
		criterions.add(cri1_2);
	}
    
    Criterion cri2=Restrictions.eq("visibility", 1);
    Criterion cri4=Restrictions.eq("surveyModel", 4);

    criterions.add(cri2);
    criterions.add(cri4);
    page.setOrderBy("createDate");
	page.setOrderDir("desc");
	
    return surveyDirectoryDao.findPage(page,criterions.toArray(new Criterion[criterions.size()]) );
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:24,代码来源:SurveyDirectoryManagerImpl.java

示例2: findByIndex

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public List<SurveyDirectory> findByIndex() {
    Criterion cri1=Restrictions.eq("visibility", 1);
    Criterion cri2=Restrictions.eq("parentId", "402880e5428a2dca01428a2f1f290000");
    Criterion cri3=Restrictions.eq("surveyTag", 1);
    Criterion cri4=Restrictions.isNull("sid");
    Page<SurveyDirectory> page=new Page<SurveyDirectory>();
    page.setOrderBy("createDate");
	page.setOrderDir("desc");
	page.setPageSize(10);
    List<SurveyDirectory> surveys = surveyDirectoryDao.findPage(page, cri1,cri2,cri3,cri4).getResult();
    return surveys;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:14,代码来源:SurveyDirectoryManagerImpl.java

示例3: getPg

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
public Pg getPg(String nums, String tbk, String proms){
	logger.debug("IN - nums: {}, tbk: {}, proms: {}", nums, tbk , proms);
	Criterion whereNums = Restrictions.eq("nums", nums);
	Criterion whereTbk = Restrictions.eq("tbk", tbk).ignoreCase();
	Criterion whereProms = Restrictions.eq("proms", proms);
	
	Pg pg = (Pg) getSession()
			.createCriteria(Pg.class)
			.add(whereNums)
			.add(whereTbk)
			.add(whereProms)
			.uniqueResult();
	return pg;
}
 
开发者ID:mjfcolas,项目名称:infotaf,代码行数:15,代码来源:PgDao.java

示例4: getOrderById

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
public int getOrderById(String quId){
	Criterion criterion=Restrictions.eq("quId", quId);
	QuChenOption quChenOption=quChenOptionDao.findFirst("orderById", false, criterion);
	if(quChenOption!=null){
		return quChenOption.getOrderById();
	}
	return 0;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:9,代码来源:QuChenOptionManagerImpl.java

示例5: revokeAcceptance

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
@Transactional(propagation = Propagation.REQUIRED)
public void revokeAcceptance(Item item, String userID)
{
	Criterion c1 = Restrictions.eq("item", item);
	Criterion c2 = Restrictions.eq("user", userID);
	delete(c1, c2);
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:DrmServiceImpl.java

示例6: getSurveyBySid

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public SurveyDirectory getSurveyBySid(String sid) {
	Criterion criterion=Restrictions.eq("sid", sid);
	SurveyDirectory surveyDirectory = surveyDirectoryDao.findUnique(criterion);
	getSurveyDetail(surveyDirectory.getId(),surveyDirectory);
	return surveyDirectory;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:8,代码来源:SurveyDirectoryManagerImpl.java

示例7: search

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public List<TLEGroup> search(String query)
{
	Criterion c1 = Restrictions.ilike("name", query.replace('*', '%'));
	Criterion c2 = Restrictions.eq("institution", CurrentInstitution.get());

	return dao.findAllByCriteria(Order.asc("name"), -1, c1, c2);
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:TLEGroupServiceImpl.java

示例8: getOrderById

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
public int getOrderById(String quId){
	Criterion criterion=Restrictions.eq("quId", quId);
	QuScore quRadio=quScoreDao.findFirst("orderById", false, criterion);
	if(quRadio!=null){
		return quRadio.getOrderById();
	}
	return 0;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:9,代码来源:QuScoreManagerImpl.java

示例9: countRole

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
public long countRole(RoleEnum role){
	logger.debug("IN - rôle: {}", role.name());
	
	Criterion whereRole = Restrictions.eq("role", role.name());
	
	return (long)getSession()
			.createCriteria(Role.class)
			.add(whereRole)
			.setProjection(Projections.rowCount()).uniqueResult();
}
 
开发者ID:mjfcolas,项目名称:infotaf,代码行数:11,代码来源:RoleDao.java

示例10: userDeletedEvent

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
@Transactional
public void userDeletedEvent(UserDeletedEvent event)
{
	Criterion c1 = Restrictions.eq("key.userID", event.getUserID());
	Criterion c2 = Restrictions.eq("key.institution", CurrentInstitution.get().getDatabaseId());

	for( UserPreference pref : userPreferencesDao.findAllByCriteria(c1, c2) )
	{
		userPreferencesDao.delete(pref);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:UserPreferenceServiceImpl.java

示例11: getPreferenceForAllUsers

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public Map<String, String> getPreferenceForAllUsers(String key)
{
	Map<String, String> prefMap = Maps.newHashMap();
	Criterion c1 = Restrictions.eq("key.preferenceID", key);
	Criterion c2 = Restrictions.eq("key.institution", CurrentInstitution.get().getDatabaseId());
	for( UserPreference pref : userPreferencesDao.findAllByCriteria(c1, c2) )
	{
		prefMap.put(pref.getKey().getUserID(), pref.getData());
	}
	return prefMap;
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:UserPreferenceServiceImpl.java

示例12: restricions

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public void restricions() {
	Session ses=null;
	//get the session
	ses=HibernateUtil.getSession();
	
		System.out.println("\n\tPRICE Less than 500");
		//create criteria
	Criteria c=ses.createCriteria(product.class);
	//create criterion objects for the restriction methods
	Criterion lt=Restrictions.lt("price", 500f);
	//add restriction to criteria
	c.add(lt);
	//execute the Criteria
	List<product> list=c.list();
	//display the list
		list.forEach(row->{
			System.out.println(row);
		});
		
	System.out.println("\n\tPRICE Greater than 500");
	
	Criteria c1=ses.createCriteria(product.class);
	
	Criterion gt=Restrictions.gt("price", 500f);
	c1.add(gt);
	List<product> list1=c1.list();
		list1.forEach(row->{
			System.out.println(row);
		});
		
System.out.println("\n\tPRICE Less than or Equal 500");
		Criteria c2=ses.createCriteria(product.class);
		
		Criterion le=Restrictions.le("price", 500f);
		c2.add(le);
		List<product> list2=c2.list();
			list2.forEach(row->{
				System.out.println(row);
			});
			
			System.out.println("\n\tPRICE Greater than or Equal 500");
					Criteria c3=ses.createCriteria(product.class);
					
					Criterion ge=Restrictions.ge("price", 500f);
					c3.add(ge);
					List<product> list3=c3.list();
						list3.forEach(row->{
							System.out.println(row);
						});
						
						
								Criteria c4=ses.createCriteria(product.class);
								
								Criterion eq=Restrictions.eq("price", 500f);
								c4.add(eq);
								List<product> list4=c4.list();
								System.out.println("\n\tPRICE  Equal 500");
									list4.forEach(row->{
										System.out.println(row);
									});
									//close the session
									HibernateUtil.closeSession(ses);
}
 
开发者ID:pratikdimble,项目名称:Hibernate_Criteria_Queries_Using_DAO_Using_MAVEN,代码行数:65,代码来源:DAO_IMPL.java

示例13: findUniqueBy

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public T findUniqueBy(final String propertyName, final Object value) {
	AssertUtils.hasText(propertyName, "propertyName不能为空");
	Criterion criterion = Restrictions.eq(propertyName, value);
	return (T) createCriteria(criterion).uniqueResult();
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:7,代码来源:SimpleHibernateDao.java

示例14: findAnswer

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public List<AnCompChenRadio> findAnswer(String belongAnswerId, String quId) {//belongAnswerId quId
	Criterion criterion1=Restrictions.eq("belongAnswerId", belongAnswerId);
	Criterion criterion2=Restrictions.eq("quId", quId);
	return anCompChenRadioDao.find(criterion1,criterion2);
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:7,代码来源:AnCompChenRadioManagerImpl.java

示例15: exportXLS

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public String exportXLS(String surveyId, String savePath) {
	String basepath = surveyId + "";
	String urlPath = "/file/" + basepath + "/";// 下载所用的地址
	String path = urlPath.replace("/", File.separator);// 文件系统路径
	// File.separator +
	// "file" +
	// File.separator+basepath
	// + File.separator;
	savePath = savePath + path;
	File file = new File(savePath);
	if (!file.exists())
		file.mkdirs();

	SurveyDirectory surveyDirectory = directoryManager.getSurvey(surveyId);
	String fileName = surveyId + "_exportSurvey.xls";

	XLSExportUtil exportUtil = new XLSExportUtil(fileName, savePath);
	Criterion cri1 = Restrictions.eq("surveyId",surveyId);
	Page<SurveyAnswer> page = new Page<SurveyAnswer>();
	page.setPageSize(5000);
	try {
		page = findPage(page,cri1);
		int totalPage = page.getTotalPage();
		List<SurveyAnswer> answers = page.getResult();
		List<Question> questions = questionManager.findDetails(surveyId,"2");
		exportXLSTitle(exportUtil, questions);
		int answerListSize = answers.size();
		for (int j = 0; j < answerListSize; j++) {
			SurveyAnswer surveyAnswer = answers.get(j);
			String surveyAnswerId = surveyAnswer.getId();
			exportUtil.createRow(j+1);
			exportXLSRow(exportUtil, surveyAnswerId, questions, surveyAnswer);
			System.out.println(j+1+"/"+answerListSize);
		}
		exportUtil.exportXLS();
	} catch (Exception e) {
		e.printStackTrace();
	}
	return urlPath + fileName;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:42,代码来源:SurveyAnswerManagerImpl.java


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