I have some logically deleted entries (i.e. active=false ) that cause problems with my @ManyToOne mapping as more than one result is returned by the join column.
I only need to include entries where active=true , which, as I thought, I could achieve:
@ManyToOne @NotFound(action = NotFoundAction.IGNORE) @JoinColumn(name = "site_id", referencedColumnName = "site_id", insertable = false, updatable = false) @WhereJoinTable(clause = "active=true") private Site site;
However, it seems that WhereJoinTable not using hibernate (perhaps its value is only for OneToMany ?), Since active=true not displayed in the generated SQL (logs), and the problem persists.
Can I include a where clause to connect a ManyToOne and how?
source share