Hibernate如何使用UserType类型为条件查询
BBBLA 2018-04-20 08:54:01
求助各位大神 , 我想问问Hibernate里能不能用实现了UserType的自定义类型作为条件用Criteria或者query 查询啊? 比如我想查询在startDate在某个日期范围内的Student数据 , 应该怎么设置Criteria.add(Restrictions.between("StudyDate", aDate, bDate)) 这样的查询呢。
Student {
int id;
StudyDate studyDate;
}
StudyDate implement UserType{
Date startDate;
Date endDate;
String TimeZone;
public Class returnedClass() {
..... } public int[] sqlTypes() { ... }
.....
}