Hibernate-Search:如何搜索日期?

时间:2010-04-16 15:32:21

标签: hibernate hibernate-search

@Entity
@Table(name = "USERS")
public class User {
 @Id
 @GeneratedValue(strategy = GenerationType.AUTO)
 private long id;

 @Column(name = "USERNAME", nullable = false, length = 20)
 private String userName;

 @Column(name = "PASSWORD", nullable = false, length = 10)
 private String password;

 @Column(name = "Date", nullable = false )
 private Date date;
}

如何选择日期介于

之间的记录
  • [现在|现在-x小时]
  • [现在| now-x days]
  • [现在| now-x个月]
  • [现在| now-x years]

1 个答案:

答案 0 :(得分:0)

与其他字段相同:< => =或等等

您可以使用commons-lang / DateUtils来修改日期。