I have updated the version of Hibernate ORM to the latest stable: 5.4.15.Final, since I saw that one important issue has been resolved (ref: > https://hibernate.atlassian.net/browse/HHH-8091). And today we have noticed something else: that @Where clause is not taken into account. We have @OneToMany relation, here is the example:
@OneToMany(mappedBy = "student")
@Where(clause = "is_active = true and age(now(), created_ts) <= '4 days'")
private List<StudentMarkData> newMarks;
The where clause is not being added to the query at all.
Also, I could not see any difference in the documentation for using @Where.
The latest version that it works is 5.4.12.Final.
Asked the question in a Hibernate Forum: https://discourse.hibernate.org/t/hibernate-orm-5-4-13-final-or-higher-where-clause-is-not-taken-into-account/4165