org.hibernate.query.Query.setDate()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.hibernate.query.Query.setDate方法的一些代码示例,展示了Query.setDate的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setDate方法的具体详情如下:
包路径:org.hibernate.query.Query
类名称:Query
方法名:setDate

Query.setDate介绍

[英]Bind a positional Date-valued parameter using just the Date portion.
[中]仅使用日期部分绑定位置日期值参数。

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testComponentFormulaQuery() {
  Session s = openSession();
  Transaction t = s.beginTransaction();
  s.createQuery("from User u where u.person.yob = 1999").list();
  s.createCriteria(User.class)
    .add( Property.forName("person.yob").between( new Integer(1999), new Integer(2002) ) )
    .list();
  if ( getDialect().supportsRowValueConstructorSyntax() ) {
    s.createQuery("from User u where u.person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 34, 'Peachtree Rd')")
      .setDate("dob", new Date("March 25, 1974")).list();
    s.createQuery("from User where person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 34, 'Peachtree Rd')")
      .setDate("dob", new Date("March 25, 1974")).list();
  }
  t.commit();
  s.close();
}

代码示例来源:origin: hibernate/hibernate-orm

.setDate("date", new Date() )
  .uniqueResult();
assertEquals( e.getPerson().getName(), "Gavin King" );

代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter

@Override
@SuppressWarnings("deprecation")
public Query setDate(final String name, final Date date) {
  if (queryV2ForCompare != null) {
    queryV2ForCompare.setDate(name, date);
  }
  query.setDate(name, date);
  return this;
}

代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter

@Override
@SuppressWarnings("deprecation")
public Query setDate(final int position, final Date date) {
  if (queryV2ForCompare != null) {
    queryV2ForCompare.setDate(position, date);
  }
  query.setDate(adjustParameterPosition(position), date);
  return this;
}

代码示例来源:origin: jpos/jPOS-EE

@SuppressWarnings("unchecked")
public List<Thing> listByDateValue (String type, Date value) {
  Query query = db.session().getNamedQuery ("list-by-date-value")
    .setString ("type", type)
    .setDate ("value", value);
  return (List<Thing>) query.list();
}
@SuppressWarnings("unchecked")

代码示例来源:origin: jpos/jPOS-EE

@SuppressWarnings("unchecked")
public List<Thing> listByDateNameValue (String type, String name, Date value) {
  Query query = db.session().getNamedQuery ("list-by-date-name-value")
    .setString ("type", type)
    .setString ("name", name)
    .setDate ("value", value);
  return (List<Thing>) query.list();
}

相关文章