I have a collection of strings defined as follows:
List<String> names
and mapped as follows...
<idbag name="names" table="t_object_names">
<collection-id column="id" type="long">
<generator class="sequence">
<param name="sequence">
sequence_id
</param>
</generator>
</collection-id>
<key column="object" not-null="true" />
<element column="name" type="java.lang.String"/>
</idbag>
... and I'm trying to figure out how I can use a Criteria query to return those objects which have a particular name (i.e pass a String in, and get those objects which have this value in their List of names)
I'm trying
criteria.createAlias("names", "n", CriteriaSpecification.LEFT_JOIN)
.add(Restrictions.eq("n.name", name));
but this gives me an error:
"collection was not an association"
Does anyone know whether I can use Criteria queries to do this ?
I need them because this restriction has to be applied alongside many others, conditionally.
_________________ ----
Matt
|