本文整理了Java中org.hibernate.Query.setDate
方法的一些代码示例,展示了Query.setDate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setDate
方法的具体详情如下:
包路径:org.hibernate.Query
类名称:Query
方法名:setDate
[英]Bind a positional Date-valued parameter using just the Date portion.
[中]仅使用日期部分绑定位置日期值参数。
代码示例来源:origin: hibernate/hibernate-orm
tx = s.beginTransaction();
Query q = s.getNamedQuery( "night.moreRecentThan" );
q.setDate( "date", aMonthAgo );
assertEquals( 1, q.list().size() );
q = s.getNamedQuery( "night.moreRecentThan" );
q.setDate( "date", inAMonth );
assertEquals( 0, q.list().size() );
Statistics stats = sessionFactory().getStatistics();
代码示例来源:origin: openmrs/openmrs-core
/**
* Gets all active diagnoses related to the specified patient.
*
* @param patient the patient whose active diagnoses are being queried.
* @return all active diagnoses associated with the specified patient.
*/
@SuppressWarnings("unchecked")
@Override
public List<Diagnosis> getActiveDiagnoses(Patient patient, Date fromDate) {
String fromDateCriteria = "";
if(fromDate != null){
fromDateCriteria = " and d.dateCreated >= :fromDate ";
}
Query query = sessionFactory.getCurrentSession().createQuery(
"from Diagnosis d where d.patient.patientId = :patientId and d.voided = false "
+ fromDateCriteria
+ " order by d.dateCreated desc");
query.setInteger("patientId", patient.getId());
if(fromDate != null){
query.setDate("fromDate", fromDate);
}
return query.list();
}
代码示例来源:origin: openmrs/openmrs-core
query.setInteger("patientId", patient.getPatientId());
query.setInteger("creator", patient.getCreator().getUserId());
query.setDate("dateCreated", patient.getDateCreated());
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate
@Override
public Query setDate(int i, Date date) {
return query.setDate(i, date);
}
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate
@Override
public Query setDate(String s, Date date) {
return query.setDate(s, date);
}
代码示例来源:origin: ezbz/projectx
@Override
public Query setDate(final int position, final Date date) {
return query.setDate(position, date);
}
代码示例来源:origin: stackoverflow.com
String queryStr = "select * from OmniMainEntity o where o.dateTime BETWEEN :startDate AND :endDate)"; // The query now changed to database independent
Query query = manager.createQuery(queryStr);
query.setDate("startDate", startDate);
query.setDate("endDate", endDate);
代码示例来源:origin: riotfamily/riot
public TypedQuery<T> setDate(String name, Date date) {
query.setDate(name, date);
return this;
}
代码示例来源:origin: ezbz/projectx
@Override
public Query setDate(final String name, final Date date) {
return query.setDate(name, date);
}
代码示例来源:origin: riotfamily/riot
public TypedQuery<T> setDate(int position, Date date) {
query.setDate(position, date);
return this;
}
代码示例来源:origin: stackoverflow.com
Query q = session.CreateQuery("select * from Ifcitsv2013 left join IfcitsSensorphistory as h where timestamp between :startDate and :finishDate and h.id = 50");
q.setDate("startDate", startDate);
q.setDate("finishDate", finishDate);
List result = q.list();
代码示例来源:origin: michael8335/zeus2
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Query query=session.createQuery("from com.taobao.zeus.store.mysql.persistence.GroupPersistence where gmt_modified>?");
query.setDate(0, ignoreContentGroupJudge.lastModified);
List<GroupPersistence> list=query.list();
List<GroupDescriptor> result=new ArrayList<GroupDescriptor>();
for(GroupPersistence p:list){
result.add(PersistenceAndBeanConvert.convert(p));
}
return result;
}
});
代码示例来源:origin: ctripcorp/dataworks-zeus
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Query query=session.createQuery("from com.taobao.zeus.store.mysql.persistence.GroupPersistence where gmt_modified>?");
query.setDate(0, ignoreContentGroupJudge.lastModified);
List<GroupPersistence> list=query.list();
List<GroupDescriptor> result=new ArrayList<GroupDescriptor>();
for(GroupPersistence p:list){
result.add(PersistenceAndBeanConvertOld.convert(p));
}
return result;
}
});
代码示例来源:origin: stackoverflow.com
Query query = session.getNamedQuery("User.findByHash");
query.setString("hash", hash);
query.setDate("hash", new Date());
代码示例来源:origin: stackoverflow.com
Query query = session.getNamedQuery("User.findByHash");
query.setString("hash", hash);
query.setDate("date_time_terminate", new Date());
代码示例来源:origin: org.opensingular/singular-support
public static Query setParametersQuery(Query query, Map<String, Object> params) {
for (Map.Entry<String, Object> parameter : params.entrySet()) {
if (parameter.getValue() instanceof Collection<?>) {
query.setParameterList(parameter.getKey(),
(Collection<?>) parameter.getValue());
} else if (parameter.getValue() instanceof Integer) {
query.setInteger(parameter.getKey(), (Integer) parameter.getValue());
} else if (parameter.getValue() instanceof Date) {
query.setDate(parameter.getKey(), (Date) parameter.getValue());
} else {
query.setParameter(parameter.getKey(), parameter.getValue());
}
}
return query;
}
代码示例来源:origin: sakaiproject/sakai
@Override
public void markExpiredAccessors() {
getHibernateTemplate().execute(session -> {
session.createQuery(
"UPDATE Accessor a SET a.status=? WHERE a.expirationDate < ?")
.setParameter(0, Accessor.Status.EXPIRED)
.setDate(1, new Date())
.executeUpdate();
return null;
});
}
代码示例来源:origin: michael8335/zeus2
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Query query=session.createQuery("select id,groupId from com.taobao.zeus.store.mysql.persistence.JobPersistence where gmt_modified>?");
query.setDate(0, ignoreContentJobJudge.lastModified);
List<Object[]> list=query.list();
List<JobDescriptor> result=new ArrayList<JobDescriptor>();
for(Object[] o:list){
JobDescriptor jd=new JobDescriptor();
jd.setId(String.valueOf(o[0]));
jd.setGroupId(String.valueOf(o[1]));
result.add(jd);
}
return result;
}
});
代码示例来源: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: org.sakaiproject.samigo/samigo-services
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();
}
内容来源于网络,如有侵权,请联系作者删除!