How to use @Where in Hibernate

Try something like:

@Column(name="POSTS_REF")
@Where(clause="state="PostPublished"")
private List<Posts> userPosts;

or

@Column(name="POSTS_REF")
@Where(clause="PostPublished=true")
private List<Posts> userPosts;

depending on the status field type on your Post entity.

Leave a Comment