Hibernate-Search: How to search dates?

Posted by Aaron on Stack Overflow See other posts from Stack Overflow or by Aaron
Published on 2010-04-16T15:32:20Z Indexed on 2010/04/16 18:43 UTC
Read the original article Hit count: 314

Filed under:
|
@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;
}

How can I select the records which have the date between

  • [now | now-x hours]
  • [now | now-x days]
  • [now | now-x months]
  • [now | now-x years]

© Stack Overflow or respective owner

Related posts about hibernate-search

Related posts about hibernate