I solved the problem with @Filter:
@FilterDef(name = "dateFilter", parameters = { @ParamDef(name = "date1", type = "date"), @ParamDef(name = "date2", type = "date") }) @Filter(name = "dateFilter", condition = "date >= :date1 and date <= :date2")
and applying it to the session:
session.enableFilter("dateFilter") .setParameter("date1", date1) .setParameter("date2", date2);
By the way, when working with Hibernate, what should I use for queries: is it a native mechanism or "raw" SQL, how is an "internal join" in this case?
source share