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


Java DetachedCriteria.setProjection方法代码示例

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


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

示例1: getLast

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
public QuotePE getLast(String sigle) {
	Session session = getSession();

	DetachedCriteria  maxDate = DetachedCriteria.forClass(QuotePE.class);
	maxDate.add(Restrictions.eq("symbol", sigle));
	maxDate.setProjection(Projections.max("creationDateTime"));
	
   	Criteria criteria = session.createCriteria(QuotePE.class);
   	criteria.add(Restrictions.eq("symbol", sigle));
   	criteria.add(Property.forName("creationDateTime").eq(maxDate));
   	
	QuotePE pe = (QuotePE) criteria.uniqueResult();
	session.close();
	
	return pe;
}
 
开发者ID:auTasso,项目名称:SandBoxNGSB,代码行数:18,代码来源:QuoteDAOImpl.java

示例2: createEcrfFieldStatusEntryDetachedCriteriaMaxId

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
private static DetachedCriteria createEcrfFieldStatusEntryDetachedCriteriaMaxId(org.hibernate.Criteria ecrfFieldStatusEntryCriteria, org.hibernate.Criteria ecrfFieldCriteria,
		org.hibernate.Criteria probandListEntryCriteria,
		ECRFFieldStatusQueue queue, Long probandListEntryId, Long ecrfFieldId) {
	DetachedCriteria subQuery = createEcrfFieldStatusEntryDetachedCriteria(ecrfFieldStatusEntryCriteria, ecrfFieldCriteria, probandListEntryCriteria, probandListEntryId,
			ecrfFieldId);
	if (queue != null) {
		subQuery.add(Restrictions.eq("queue", queue));
		subQuery.setProjection(Projections.max("id"));
	} else {
		ProjectionList proj = Projections.projectionList();
		proj.add(Projections.sqlGroupProjection(
				"max({alias}.id) as maxId",
				"{alias}.queue",
				new String[] { "maxId" },
				new org.hibernate.type.Type[] { Hibernate.LONG }));
		subQuery.setProjection(proj);
	}

	return subQuery;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:21,代码来源:ECRFFieldStatusEntryDaoImpl.java

示例3: handleFindExpiring

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<Password> handleFindExpiring(Date today,
		Long departmentId, AuthenticationType authMethod, VariablePeriod reminderPeriod,
		Long reminderPeriodDays, PSFVO psf) throws Exception {
	org.hibernate.Criteria passwordCriteria = createPasswordCriteria("password0");
	SubCriteriaMap criteriaMap = new SubCriteriaMap(Password.class, passwordCriteria);
	if (departmentId != null) {
		criteriaMap.createCriteria("user").add(Restrictions.eq("department.id", departmentId.longValue()));
	}
	if (authMethod != null) {
		criteriaMap.createCriteria("user").add(Restrictions.eq("authMethod", authMethod));
	}
	DetachedCriteria subQuery = DetachedCriteria.forClass(PasswordImpl.class, "password1"); // IMPL!!!!
	subQuery.add(Restrictions.eqProperty("password1.user", "password0.user"));
	subQuery.setProjection(Projections.max("id"));
	passwordCriteria.add(Subqueries.propertyEq("id", subQuery));
	passwordCriteria.add(Restrictions.eq("expires", true)); // performance only...
	if (psf != null) {
		PSFVO sorterFilter = new PSFVO();
		sorterFilter.setFilters(psf.getFilters());
		sorterFilter.setSortField(psf.getSortField());
		sorterFilter.setSortOrder(psf.getSortOrder());
		CriteriaUtil.applyPSFVO(criteriaMap, sorterFilter);
	}
	ArrayList<Password> resultSet = CriteriaUtil.listExpirations(passwordCriteria, today, null, null, null, reminderPeriod, reminderPeriodDays);
	return (Collection<Password>) CriteriaUtil.applyPVO(resultSet, psf, false); // no dupes by default
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:28,代码来源:PasswordDaoImpl.java

示例4: handleGetProbandList

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<ProbandListEntry> handleGetProbandList(
		Long trialId, org.phoenixctms.ctsms.enumeration.ProbandListStatusLogLevel logLevel, boolean last)
				throws Exception {
	// http://stackoverflow.com/questions/1648426/hibernate-detached-queries-as-a-part-of-the-criteria-query
	// https://forum.hibernate.org/viewtopic.php?p=2317841#2317841
	org.hibernate.Criteria listEntryCriteria = createListEntryCriteria();
	boolean distinctRoot = false;
	if (trialId != null) {
		listEntryCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
	}
	if (logLevel != null) {
		org.hibernate.Criteria statusEntryCriteria;
		if (last) {
			statusEntryCriteria = listEntryCriteria.createCriteria("statusEntries", "probandListStatusEntry0", CriteriaSpecification.INNER_JOIN);
		} else {
			statusEntryCriteria = listEntryCriteria.createCriteria("statusEntries", CriteriaSpecification.INNER_JOIN);
		}
		org.hibernate.Criteria statusTypeCriteria = statusEntryCriteria.createCriteria("status", CriteriaSpecification.INNER_JOIN);
		org.hibernate.Criteria logLevelCriteria = statusTypeCriteria.createCriteria("logLevels", CriteriaSpecification.INNER_JOIN);
		logLevelCriteria.add(Restrictions.eq("logLevel", logLevel));
		if (last) {
			DetachedCriteria subQuery = DetachedCriteria.forClass(ProbandListStatusEntryImpl.class, "probandListStatusEntry1"); // IMPL!!!!
			subQuery.add(Restrictions.eqProperty("probandListStatusEntry1.listEntry", "probandListStatusEntry0.listEntry"));
			subQuery.setProjection(Projections.max("id"));
			statusEntryCriteria.add(Subqueries.propertyEq("id", subQuery));
		} else {
			// listEntryCriteria.setResultTransformer(org.hibernate.Criteria.DISTINCT_ROOT_ENTITY);
			distinctRoot = true;
		}
	}
	listEntryCriteria.addOrder(Order.asc("trial"));
	listEntryCriteria.addOrder(Order.asc("position"));
	if (distinctRoot) {
		return CriteriaUtil.listDistinctRoot(listEntryCriteria, this, "trial.id", "position");
	} else {
		return listEntryCriteria.list();
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:40,代码来源:ProbandListEntryDaoImpl.java

示例5: handleFindByServiceMethodUser

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<Permission> handleFindByServiceMethodUser(
		String serviceMethod, Long userId, Boolean profilePermissionActive,
		Boolean userPermissionProfileActive) throws Exception {
	org.hibernate.Criteria permissionCritria = createPermissionCriteria();
	if (serviceMethod != null) {
		permissionCritria.add(Restrictions.eq("serviceMethod", serviceMethod));
	}
	if (userId != null || profilePermissionActive != null || userPermissionProfileActive != null) {
		org.hibernate.Criteria profilePermissionCritria = permissionCritria.createCriteria("profilePermissions", CriteriaSpecification.LEFT_JOIN);
		if (profilePermissionActive != null) {
			profilePermissionCritria.add(Restrictions.eq("active", profilePermissionActive.booleanValue()));
		}
		if (userId != null || userPermissionProfileActive != null) {
			DetachedCriteria subQuery = DetachedCriteria.forClass(UserPermissionProfileImpl.class, "userPermissionProfile"); // IMPL!!!!
			subQuery.setProjection(Projections.projectionList().add(Projections.property("profile")));
			if (userId != null) {
				subQuery.add(Restrictions.eq("user.id", userId.longValue()));
			}
			if (userPermissionProfileActive != null) {
				subQuery.add(Restrictions.eq("active", userPermissionProfileActive.booleanValue()));
			}
			profilePermissionCritria.add(Subqueries.propertyIn("profile", subQuery));
		}
	}
	return permissionCritria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:28,代码来源:PermissionDaoImpl.java

示例6: handleFindByMoneyTransferNoParticipation

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<Proband> handleFindByMoneyTransferNoParticipation(Long trialId,
		PaymentMethod method, String costType, Boolean paid, boolean total,
		Boolean person, PSFVO psf)
				throws Exception {
	org.hibernate.Criteria probandCriteria = createProbandCriteria("proband0");
	if (person != null) {
		probandCriteria.add(Restrictions.eq("person", person.booleanValue()));
	}
	SubCriteriaMap criteriaMap = new SubCriteriaMap(Proband.class, probandCriteria);
	Criteria moneyTransferCriteria = criteriaMap.createCriteria("moneyTransfers");
	moneyTransferCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
	if (method != null) {
		moneyTransferCriteria.add(Restrictions.eq("method", method));
	}
	if (paid != null) {
		moneyTransferCriteria.add(Restrictions.eq("paid", paid.booleanValue()));
	}
	CategoryCriterion.apply(moneyTransferCriteria, new CategoryCriterion(costType, "costType", MatchMode.EXACT, EmptyPrefixModes.ALL_ROWS));
	DetachedCriteria subQuery = DetachedCriteria.forClass(ProbandListEntryImpl.class, "probandListEntry"); // IMPL!!!!
	subQuery.setProjection(Projections.rowCount());
	subQuery.add(Restrictions.eqProperty("proband.id", "proband0.id"));
	subQuery.add(Restrictions.eq("trial.id", trialId.longValue()));
	if (!total) {
		subQuery.createCriteria("lastStatus", CriteriaSpecification.INNER_JOIN).createCriteria("status", CriteriaSpecification.INNER_JOIN)
		.add(Restrictions.eq("count", true));
	}
	probandCriteria.add(Subqueries.eq(0l, subQuery));
	return CriteriaUtil.listDistinctRootPSFVO(criteriaMap, psf, this);
	// return probandCriteria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:32,代码来源:ProbandDaoImpl.java

示例7: createEcrfFieldValueDetachedCriteriaMaxId

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
private static DetachedCriteria createEcrfFieldValueDetachedCriteriaMaxId(org.hibernate.Criteria ecrfFieldValueCriteria, org.hibernate.Criteria ecrfFieldCriteria,
		org.hibernate.Criteria probandListEntryCriteria,
		Long probandListEntryId, Long ecrfFieldId) {
	DetachedCriteria subQuery = createEcrfFieldValueDetachedCriteria(ecrfFieldValueCriteria, ecrfFieldCriteria, probandListEntryCriteria, probandListEntryId, ecrfFieldId);
	subQuery.setProjection(Projections.max("id"));
	return subQuery;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:8,代码来源:ECRFFieldValueDaoImpl.java

示例8: handleFindBySignup

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<Trial> handleFindBySignup(Long departmentId, boolean ignoreSignupInquiries, PSFVO psf) throws Exception {
	org.hibernate.Criteria trialCriteria = createTrialCriteria("trial0");
	SubCriteriaMap criteriaMap = new SubCriteriaMap(Trial.class, trialCriteria);
	if (departmentId != null) {
		trialCriteria.add(Restrictions.eq("department.id", departmentId.longValue()));
	}
	org.hibernate.Criteria statusCriteria = trialCriteria.createCriteria("status", "trialStatus", CriteriaSpecification.INNER_JOIN);
	statusCriteria.add(Restrictions.eq("lockdown", false));
	DetachedCriteria subQuery = DetachedCriteria.forClass(InquiryImpl.class, "inquiry"); // IMPL!!!!
	subQuery.setProjection(Projections.rowCount());
	subQuery.add(Restrictions.eqProperty("trial.id", "trial0.id"));
	subQuery.add(Restrictions.eq("activeSignup", true));
	trialCriteria.add(
			Restrictions.or(
					Restrictions.eq("signupProbandList", true),
					Restrictions.and(
							ignoreSignupInquiries ? Subqueries.lt(0l, subQuery) : Restrictions.and(
									Restrictions.eq("signupInquiries", true),
									Subqueries.lt(0l, subQuery)
									// Restrictions.sizeGt("inquiries", 0)
									),
									Restrictions.eq("trialStatus.inquiryValueInputEnabled", true)
							)
					)
			);
	// if (probandList != null) {
	// trialCriteria.add(Restrictions.eq("signupProbandList", probandList.booleanValue()));
	// }
	// if (inquiries != null) {
	// trialCriteria.add(Restrictions.eq("signupInquiries", inquiries.booleanValue()));
	// statusCriteria.add(Restrictions.eq("inquiryValueInputEnabled", true));
	// trialCriteria.add(Restrictions.sizeGt("inquiries", 0));
	// }
	CriteriaUtil.applyPSFVO(criteriaMap, psf);
	return trialCriteria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:38,代码来源:TrialDaoImpl.java

示例9: getAdvancedCount

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
/**
 * Узнать сколько предварительно записанных для этой услуги на дату
 *
 * @param date на эту дату узнаем количество записанных предварительно
 * @param strictStart false - просто количество записанных на этот день, true - количество
 * записанных на этот день начиная с времени date
 * @return количество записанных предварительно
 */
public int getAdvancedCount(Date date, boolean strictStart) {
    final GregorianCalendar forDay = new GregorianCalendar();
    forDay.setTime(date);

    final GregorianCalendar today = new GregorianCalendar();
    if (!strictStart && forDay.get(GregorianCalendar.DAY_OF_YEAR) == today
        .get(GregorianCalendar.DAY_OF_YEAR)
        && day_y != today.get(GregorianCalendar.DAY_OF_YEAR)) {
        day_y = today.get(GregorianCalendar.DAY_OF_YEAR);
        dayAdvs = -100;
    }
    if (!strictStart && forDay.get(GregorianCalendar.DAY_OF_YEAR) == today
        .get(GregorianCalendar.DAY_OF_YEAR) && dayAdvs >= 0) {
        return dayAdvs;
    }

    final DetachedCriteria dc = DetachedCriteria.forClass(QAdvanceCustomer.class);
    dc.setProjection(Projections.rowCount());
    if (!strictStart) {
        forDay.set(GregorianCalendar.HOUR_OF_DAY, 0);
        forDay.set(GregorianCalendar.MINUTE, 0);
    }
    final Date today_m = forDay.getTime();
    forDay.set(GregorianCalendar.HOUR_OF_DAY, 23);
    forDay.set(GregorianCalendar.MINUTE, 59);
    dc.add(Restrictions.between("advanceTime", today_m, forDay.getTime()));
    dc.add(Restrictions.eq("service", this));
    final Long cnt = (Long) (Spring.getInstance().getHt().findByCriteria(dc).get(0));
    final int i = cnt.intValue();

    forDay.setTime(date);
    if (!strictStart && forDay.get(GregorianCalendar.DAY_OF_YEAR) == today
        .get(GregorianCalendar.DAY_OF_YEAR)) {
        dayAdvs = i;
    }

    QLog.l().logger()
        .trace("Посмотрели сколько предварительных записалось в " + getName() + ". Их " + i);
    return i;
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:49,代码来源:QService.java

示例10: handleFindRecent

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<JournalEntry> handleFindRecent(JournalModule module, Long modifiedUserId, DBModule criteriaModule, Long entityDepartmentId, boolean limit, PSFVO psf)
		throws Exception {
	org.hibernate.Criteria journalCriteria = createJournalEntryCriteria("journalEntry0");
	SubCriteriaMap criteriaMap = new SubCriteriaMap(JournalEntry.class, journalCriteria);
	if (modifiedUserId != null) {
		journalCriteria.add(Restrictions.eq("modifiedUser.id", modifiedUserId.longValue()));
	}
	if (limit) {
		applyRecentJournalEntryTimestampCriterion(journalCriteria, null);
	}
	journalCriteria.add(Restrictions.or(
			Restrictions.eq("systemMessage", false),
			Restrictions.and(Restrictions.eq("systemMessage", true), Restrictions.eq("systemMessageModule", module)))
			);
	criteriaMap.createCriteria("category", CriteriaSpecification.LEFT_JOIN).add(Restrictions.or(Restrictions.eq("module", module), Restrictions.isNull("module")));
	DetachedCriteria subQuery = DetachedCriteria.forClass(JournalEntryImpl.class, "journalEntry1"); // IMPL!!!!
	subQuery.setProjection(Projections.max("id"));
	journalCriteria.add(Subqueries.propertyEq("id", subQuery));
	switch (module) {
		case INVENTORY_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.inventory", "journalEntry0.inventory"));
			if (entityDepartmentId != null) {
				criteriaMap.createCriteria("inventory").add(Restrictions.eq("department.id", entityDepartmentId.longValue()));
			}
			break;
		case STAFF_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.staff", "journalEntry0.staff"));
			if (entityDepartmentId != null) {
				criteriaMap.createCriteria("staff").add(Restrictions.eq("department.id", entityDepartmentId.longValue()));
			}
			break;
		case COURSE_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.course", "journalEntry0.course"));
			if (entityDepartmentId != null) {
				criteriaMap.createCriteria("course").add(Restrictions.eq("department.id", entityDepartmentId.longValue()));
			}
			break;
		case USER_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.user", "journalEntry0.user"));
			if (entityDepartmentId != null) {
				criteriaMap.createCriteria("user").add(Restrictions.eq("department.id", entityDepartmentId.longValue()));
			}
			break;
		case TRIAL_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.trial", "journalEntry0.trial"));
			if (entityDepartmentId != null) {
				criteriaMap.createCriteria("trial").add(Restrictions.eq("department.id", entityDepartmentId.longValue()));
			}
			break;
		case PROBAND_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.proband", "journalEntry0.proband"));
			if (entityDepartmentId != null) {
				criteriaMap.createCriteria("proband").add(Restrictions.eq("department.id", entityDepartmentId.longValue()));
			}
			break;
		case CRITERIA_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.criteria", "journalEntry0.criteria"));
			if (criteriaModule != null) {
				subQuery.createCriteria("criteria", CriteriaSpecification.INNER_JOIN).add(Restrictions.eq("module", criteriaModule));
			}
			break;
		case INPUT_FIELD_JOURNAL:
			subQuery.add(Restrictions.eqProperty("journalEntry1.inputField", "journalEntry0.inputField"));
			break;
		default:
	}
	CriteriaUtil.applyPSFVO(criteriaMap, psf);
	return journalCriteria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:71,代码来源:JournalEntryDaoImpl.java

示例11: handleGetLog

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<ECRFFieldValue> handleGetLog(Long trialId, Long probandListEntryId, Long ecrfId, boolean sort, PSFVO psf) throws Exception {

	org.hibernate.Criteria ecrfFieldValueCriteria = createEcrfFieldValueCriteria("ecrfFieldValue0");
	org.hibernate.Criteria listEntryCriteria = ecrfFieldValueCriteria.createCriteria("listEntry","probandListEntry0");
	if (trialId != null || probandListEntryId != null) {

		if (trialId != null) {
			listEntryCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
		}
		if (probandListEntryId != null) {
			listEntryCriteria.add(Restrictions.idEq(probandListEntryId.longValue()));
		}
	}
	org.hibernate.Criteria ecrfFieldCriteria = ecrfFieldValueCriteria.createCriteria("ecrfField","ecrfField0");
	if (ecrfId != null) {
		ecrfFieldCriteria.add(Restrictions.eq("ecrf.id", ecrfId.longValue()));
	}

	DetachedCriteria subQuery = createEcrfFieldValueDetachedCriteria(ecrfFieldValueCriteria, ecrfFieldCriteria, listEntryCriteria, probandListEntryId, null);
	subQuery.setProjection(Projections.rowCount());

	subQuery.add(Restrictions.or(Restrictions.isNull("index"),
			Restrictions.eqProperty("index", "ecrfFieldValue0" + ".index")));

	ecrfFieldValueCriteria.add(Subqueries.lt(1l, subQuery));


	SubCriteriaMap criteriaMap = new SubCriteriaMap(ECRFFieldValue.class, ecrfFieldValueCriteria);
	criteriaMap.registerCriteria("listEntry", listEntryCriteria);
	criteriaMap.registerCriteria("ecrfField", ecrfFieldCriteria);
	CriteriaUtil.applyPSFVO(criteriaMap, psf);
	//		if (sort) { // after applyPSFVO
	//			ecrfFieldValueCriteria.addOrder(Order.asc("index"));
	//			ecrfFieldValueCriteria.addOrder(Order.desc("id"));
	//		}
	if (sort) {
		applySortOrders(listEntryCriteria, ecrfFieldCriteria, ecrfFieldValueCriteria);
	}
	return ecrfFieldValueCriteria.list();

	//throw new Exception();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:44,代码来源:ECRFFieldValueDaoImpl.java

示例12: handleFindByInquiryValuesProbandSorted

import org.hibernate.criterion.DetachedCriteria; //导入方法依赖的package包/类
@Override
protected Collection<Trial> handleFindByInquiryValuesProbandSorted(Long departmentId, Long probandId, Boolean active, Boolean activeSignup) throws Exception {
	org.hibernate.Criteria trialCriteria = createTrialCriteria("trial0");
	if (departmentId != null) {
		trialCriteria.add(Restrictions.eq("department.id", departmentId.longValue()));
	}
	org.hibernate.Criteria statusCriteria = trialCriteria.createCriteria("status", "trialStatus", CriteriaSpecification.INNER_JOIN);
	DetachedCriteria valuesSubQuery = DetachedCriteria.forClass(InquiryValueImpl.class, "inquiryValue"); // IMPL!!!!
	valuesSubQuery.setProjection(Projections.rowCount());
	valuesSubQuery.add(Restrictions.eq("proband.id", probandId.longValue()));
	// if (active != null || activeSignup != null) {
	DetachedCriteria inquiriesSubQuery = valuesSubQuery.createCriteria("inquiry", "inquiry0", CriteriaSpecification.INNER_JOIN);
	inquiriesSubQuery.add(Restrictions.eqProperty("trial.id", "trial0.id"));
	if (active != null) {
		inquiriesSubQuery.add(Restrictions.eq("active", active.booleanValue()));
	}
	if (activeSignup != null) {
		inquiriesSubQuery.add(Restrictions.eq("activeSignup", activeSignup.booleanValue()));
	}
	inquiriesSubQuery = DetachedCriteria.forClass(InquiryImpl.class, "inquiry1"); // IMPL!!!!
	inquiriesSubQuery.setProjection(Projections.rowCount());
	inquiriesSubQuery.add(Restrictions.eqProperty("trial.id", "trial0.id"));
	if (active != null) {
		inquiriesSubQuery.add(Restrictions.eq("active", active.booleanValue()));
	}
	if (activeSignup != null) {
		inquiriesSubQuery.add(Restrictions.eq("activeSignup", activeSignup.booleanValue()));
	}
	// }
	trialCriteria.add(
			Restrictions.or(
					Subqueries.lt(0l, valuesSubQuery),
					Restrictions.and(
							Subqueries.lt(0l, inquiriesSubQuery),
							Restrictions.and(
									Restrictions.eq("trialStatus.inquiryValueInputEnabled", true),
									Restrictions.eq("trialStatus.lockdown", false)
									)
							)
					)
			);
	trialCriteria.addOrder(Order.asc("name"));
	return trialCriteria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:45,代码来源:TrialDaoImpl.java


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