Joined: Wed Apr 14, 2004 4:58 am Posts: 6
|
Hi,
i have some persistent objects which contains a set of Long values:
<class name="Task" table="tasks" polymorphism="explicit">
<id name="id" column="id" type="long">
<generator class="com.evermind.tools.hibernate.UniqueIdGenerator"/>
</id>
<!--(some properties)-->
<set name="concerned" table="task_concerned">
<key column="task_id"/>
<element column="user_id" type="long"/>
</set>
<!-- ... -->
The mapping between user and task is non-relational (task contains a list of concerned user ids but there's no constraint that forces the user to exist).
Now i want to query all tasks which contains a certain user id. I tried
"from Task t where elements(t.concerned)=42". This fails because it creates a subselect which is not supported by mysql.
When i try "from Task t where t.concerned=42" i gent an exception that the collection is not indexed.
How must i do this query?
|
|