Can someone please post (or point me to the docs) the correct syntax for querying a value-based collection which is a property of an object? I've searched the documentation, HIA, google and I just can't find it!
elements() won't work for me because I'm using MySQL.
Using the example mapping doc below, I want to write a query that does this (just can't get the damn syntax right?!) nodeIdsSet is a value Set of longs
from org.tolweb.treegrow.main.NodeImage as img where img.nodeIdsSet.value in (1,2,3)
but the syntax for img.nodeIdsSet.value is what I can't figure out. Any help would be greatly appreciated.
Hibernate version:
2.1.5
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="org.tolweb.treegrow.main.NodeImage"
table="Images"
dynamic-update="false"
dynamic-insert="false"
>
<cache usage="nonstrict-read-write" />
<id
name="id"
column="image_id"
type="int"
unsaved-value="-1"
>
<generator class="native">
</generator>
</id>
<property
name="copyrightOwner"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="copyright_owner"
/>
<property
name="copyrightEmail"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="copyright_email"
/>
<set
name="nodeIdsSet"
table="Images_To_Nodes"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
>
<cache
usage="nonstrict-read-write"
/>
<key
column="image_id"
>
</key>
<element
column="node_id"
type="long"
not-null="false"
unique="false"
/>
</set>
</class>
</hibernate-mapping>
Name and version of the database you are using:
MySQL 4.0.16-standard
_________________ Danny Mandel <dmandel at nospam dot tolweb dot org>
Lead Programmer, Tree of Life Project
http://tolweb.org
|