@JoinTable with WHERE
Trying to implement a solution to this question I'm wondering, is there any way to have a WHERE clause when using the @JoinTable annotation. If you look at the question (just skip to the table layout) I would join the two tables together with @JoinTable on the USER_ID and CHANNEL_ID but get only where one of the statuses are true.
Note that I can't just do a query as the field gives me the ability to add and remove objects as per the DAO interface this class is implementing. Putting a query in the getter will not allow me to do this. I also can'开发者_开发百科t use a UserChannel object that represents the map like JB Nizet said in his answer for the same reason
Is it possible to have a WHERE clause in the @JoinTable annotation with hibernate?
you can use @WhereJoinTable(clause = "your_condition")
精彩评论