Wouldn't it be nice if the class Restrictions would provide a method like
Code:
static Criterion Restrictions.contains(String propertyName, Object[] values)
I am aware of the existence of the method
Code:
static Criterion Restrictions.in(String propertyName, Object[] values)
but that's not what I want.
This is the case where you might use it:
Consider two entities with a many-to-many relationship, say
Code:
Document *----------*Keyword
One of the usecases is: show me all documents which contain at least an array of keywords K1, K2 and K3 (an array of variable length).
Actualy, I haven't found an elegant way to implement something similar using criteria or HQL.Anyone an elegant alternative (I've tried with Restrictions.sqlRestriction(), but ran into problems)? Or can this be considered as a valid feature request?
Regards,
Bruno.