Reputation: 171
i have two objects, linked through a third table in a many-to-many link. it is mapped the following way in one object:
@ManyToMany(cascade = {}, fetch = FetchType.LAZY)
@JoinTable(name = "PMSCampaignPublisher", joinColumns = { @JoinColumn(name = "publisherId") }, inverseJoinColumns = { @JoinColumn(name = "campaignId") })
and this way in the other object:
@ManyToMany(cascade = {}, fetch = FetchType.LAZY)
@JoinTable(name = "PMSCampaignPublisher", joinColumns = { @JoinColumn(name = "campaignId") }, inverseJoinColumns = { @JoinColumn(name = "publisherId") })
i'd like to add a boolean flag in one of the object, so when trying to get the other objects it will be limited by this boolean flag. i didn't find a way to do it - is it possible at all?
Upvotes: 0
Views: 96
Reputation: 23226
Hibernate has the @Where and @WhereJoinTable clauses you can use to filter collections.
See 2.4.6.1:
http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/
Upvotes: 1