本文整理了Java中org.hibernate.Query.setBoolean
方法的一些代码示例,展示了Query.setBoolean
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setBoolean
方法的具体详情如下:
包路径:org.hibernate.Query
类名称:Query
方法名:setBoolean
[英]Bind a positional boolean-valued parameter.
[中]绑定一个位置布尔值参数。
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate
@Override
public Query setBoolean(int i, boolean b) {
return query.setBoolean(i, b);
}
代码示例来源:origin: org.sakaiproject.profile2/profile2-impl
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_FRIEND_REQUESTS_FOR_USER);
q.setParameter(USER_UUID, userId, Hibernate.STRING);
q.setBoolean("false", Boolean.FALSE);
//q.setResultTransformer(Transformers.aliasToBean(Friend.class));
return q.list();
}
};
代码示例来源:origin: denimgroup/threadfix
@SuppressWarnings("unchecked")
@Override
public List<JobStatus> retrieveAllOpen() {
return sessionFactory
.getCurrentSession()
.createQuery(
"from JobStatus jobStatus where jobStatus.open = :open "
+ "order by jobStatus.modifiedDate desc").setBoolean("open", true)
.list();
}
代码示例来源:origin: OpenClinica/OpenClinica
@Transactional
public ArrayList<RuleSetBean> findAllRunOnSchedules(Boolean shedule){
String query = "from " + getDomainClassName() + " ruleSet where ruleSet.runSchedule = :shedule";
org.hibernate.Query q = getCurrentSession().createQuery(query);
q.setBoolean("shedule", shedule);
return (ArrayList<RuleSetBean>) q.list();
}
代码示例来源:origin: sakaiproject/sakai
public List<AssessmentGradingData> getHighestSubmittedAssessmentGradingList(final Long publishedAssessmentId) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> {
Query q = session.createQuery(
"from AssessmentGradingData a where a.publishedAssessmentId = :id and a.forGrade = :forgrade order by a.agentId asc, a.finalScore desc");
q.setLong("id", publishedAssessmentId);
q.setBoolean("forgrade", true);
return q.list();
};
List<AssessmentGradingData> assessmentGradings = getHibernateTemplate().execute(hcb);
return new ArrayList<>(assessmentGradings.stream()
.collect(Collectors.toMap(AssessmentGradingData::getAgentId, p -> p, (p, q) -> p))
.values());
}
代码示例来源:origin: org.sakaiproject.profile2/profile2-impl
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_THREADS_WITH_UNREAD_MESSAGES_COUNT);
q.setParameter(UUID, userId, Hibernate.STRING);
q.setBoolean("false", Boolean.FALSE);
return q.uniqueResult();
}
};
代码示例来源:origin: org.sakaiproject.profile2/profile2-impl
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_ALL_UNREAD_MESSAGES_COUNT);
q.setParameter(UUID, userId, Hibernate.STRING);
q.setBoolean("false", Boolean.FALSE);
return q.uniqueResult();
}
};
代码示例来源:origin: sakaiproject/sakai
@SuppressWarnings("unchecked")
public List<AssessmentGradingData> getAllSubmissions(final String publishedId) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> {
Query q = session.createQuery(
"from AssessmentGradingData a where a.publishedAssessmentId = :id and a.forGrade = :forgrade");
q.setLong("id", Long.parseLong(publishedId));
q.setBoolean("forgrade", true);
return q.list();
};
return getHibernateTemplate().execute(hcb);
}
代码示例来源:origin: sakaiproject/sakai
public Integer getNumberOfSubmissions(final String publishedAssessmentId, final String agentId) {
final HibernateCallback<List<Number>> hcb = session -> session.createQuery(
"select count(a) from AssessmentGradingData a where a.publishedAssessmentId = :id and a.agentId = :agent and a.forGrade = :forgrade")
.setLong("id", Long.parseLong(publishedAssessmentId))
.setString("agent", agentId)
.setBoolean("forgrade", true)
.list();
List<Number> list = getHibernateTemplate().execute(hcb);
return list.get(0).intValue();
}
代码示例来源:origin: sakaiproject/sakai
public Integer getTotalSubmission(final String agentId, final Long publishedAssessmentId) {
final HibernateCallback<List<Number>> hcb = session -> session
.createQuery("select count(a) from AssessmentGradingData a where a.forGrade = :forgrade and a.agentId = :agent and a.publishedAssessmentId = :id")
.setBoolean("forgrade", true)
.setString("agent", agentId)
.setLong("id", publishedAssessmentId)
.list();
List<Number> l = getHibernateTemplate().execute(hcb);
return l.get(0).intValue();
}
代码示例来源:origin: org.sakaiproject.samigo/samigo-services
public Integer getNumberOfSubmissions(final String publishedAssessmentId, final String agentId) {
final HibernateCallback<List<Number>> hcb = session -> session.createQuery(
"select count(a) from AssessmentGradingData a where a.publishedAssessmentId = :id and a.agentId = :agent and a.forGrade = :forgrade")
.setLong("id", Long.parseLong(publishedAssessmentId))
.setString("agent", agentId)
.setBoolean("forgrade", true)
.list();
List<Number> list = getHibernateTemplate().execute(hcb);
return list.get(0).intValue();
}
代码示例来源:origin: sakaiproject/sakai
public List<AssessmentGradingData> getNumberOfSubmissionsOfAllAssessmentsByAgent(final String agentId) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> session.createQuery(
"select new AssessmentGradingData(a.publishedAssessmentId, count(a)) " +
"from AssessmentGradingData as a where a.agentId = :agent and a.forGrade= :forgrade " +
"group by a.publishedAssessmentId")
.setString("agent", agentId)
.setBoolean("forgrade", true)
.list();
return getHibernateTemplate().execute(hcb);
}
代码示例来源:origin: denimgroup/threadfix
@Override
@SuppressWarnings("unchecked")
public List<Vulnerability> getFalsePositiveVulnCount(Application application,
boolean value) {
return sessionFactory
.getCurrentSession()
.createQuery("from Vulnerability vuln where vuln.application = :appId "
+ "and vuln.isFalsePositive = :fp")
.setBoolean("fp", value)
.setInteger("appId", application.getId()).list();
}
代码示例来源:origin: org.sakaiproject.samigo/samigo-services
public List<AssessmentGradingData> getNumberOfSubmissionsOfAllAssessmentsByAgent(final String agentId) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> session.createQuery(
"select new AssessmentGradingData(a.publishedAssessmentId, count(a)) " +
"from AssessmentGradingData as a where a.agentId = :agent and a.forGrade= :forgrade " +
"group by a.publishedAssessmentId")
.setString("agent", agentId)
.setBoolean("forgrade", true)
.list();
return getHibernateTemplate().execute(hcb);
}
代码示例来源:origin: sakaiproject/sakai
public List<AssessmentGradingData> getAllAssessmentGradingByAgentId(final Long publishedAssessmentId, final String agentIdString) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> {
Query q = session.createQuery(
"from AssessmentGradingData a where a.publishedAssessmentId = :id and a.agentId = :agent and a.forGrade = :forgrade order by a.submittedDate desc");
q.setLong("id", publishedAssessmentId);
q.setString("agent", agentIdString);
q.setBoolean("forgrade", true);
return q.list();
};
return getHibernateTemplate().execute(hcb);
}
代码示例来源:origin: sakaiproject/sakai
public List<AssessmentGradingData> getUnSubmittedAssessmentGradingDataList(final Long publishedAssessmentId, final String agentIdString) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> {
Query q = session.createQuery(
"from AssessmentGradingData a where a.publishedAssessmentId = :id and a.agentId = :agent and a.forGrade = :forgrade order by a.attemptDate desc");
q.setLong("id", publishedAssessmentId);
q.setString("agent", agentIdString);
q.setBoolean("forgrade", false);
return q.list();
};
return getHibernateTemplate().execute(hcb);
}
}
代码示例来源:origin: org.sakaiproject.samigo/samigo-services
public List<AssessmentGradingData> getUnSubmittedAssessmentGradingDataList(final Long publishedAssessmentId, final String agentIdString) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> {
Query q = session.createQuery(
"from AssessmentGradingData a where a.publishedAssessmentId = :id and a.agentId = :agent and a.forGrade = :forgrade order by a.attemptDate desc");
q.setLong("id", publishedAssessmentId);
q.setString("agent", agentIdString);
q.setBoolean("forgrade", false);
return q.list();
};
return getHibernateTemplate().execute(hcb);
}
}
代码示例来源:origin: sakaiproject/sakai
public int getLateSubmissionsNumberByAgentId(final Long publishedAssessmentId, final String agentIdString, final Date dueDate) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> {
Query q = session.createQuery(
"from AssessmentGradingData a where a.publishedAssessmentId = :id and a.agentId = :agent and a.forGrade = :forgrade and a.submittedDate > :submitted");
q.setLong("id", publishedAssessmentId);
q.setString("agent", agentIdString);
q.setBoolean("forgrade", true);
q.setDate("submitted", dueDate);
return q.list();
};
List<AssessmentGradingData> assessmentGradings = getHibernateTemplate().execute(hcb);
return assessmentGradings.size();
}
代码示例来源:origin: sakaiproject/sakai
public List<AssessmentGradingData> getAllAssessmentsGradingDataByAgentAndSiteId(final String agentId, final String siteId) {
final HibernateCallback<List<AssessmentGradingData>> hcb = session -> session.createQuery(
"select a " + " from AssessmentGradingData as a, AuthorizationData as az " +
"where a.agentId=:agentId and a.forGrade=:forGrade " +
"and az.agentIdString=:siteId " +
"and az.functionId=:functionId and az.qualifierId=a.publishedAssessmentId")
.setString("agentId", agentId)
.setBoolean("forGrade", true)
.setString("siteId", siteId)
.setString("functionId", "OWN_PUBLISHED_ASSESSMENT")
.list();
return getHibernateTemplate().execute(hcb);
}
代码示例来源:origin: org.ow2.bonita/bonita-server
@Override
public long hasDocuments(final ProcessInstanceUUID instanceUUID, final String documentName, final boolean metaDocument) {
final Query query = getSession().getNamedQuery("hasDocumentsOfProcessInstanceWithNameAndMetaType");
query.setString("processInstanceUUID", instanceUUID.getValue());
query.setString("name", documentName);
query.setBoolean("meta", metaDocument);
return (Long) query.uniqueResult();
}
内容来源于网络,如有侵权,请联系作者删除!