I know its been a wheil since i posted a resolution, but none of these answers work.
Let me explain a little more about what I am trying to do. I want to have hibernate automatically load the set:
<set name="laboratories" inverse="true" lazy="false">
<key property-ref="indicOrganism">
<column name="indic_organisms" not-null="true" />
</key>
<one-to-many class="com.yum.fsraqa.model.Laboratory" />
<loader query-ref="labs" />
</set>
and it is a many to many relatinship, the Laborator class has a field indicOrganisms that is a list of names deliminated by "-", ex. "One-Two-Three"
I want the IdicOrganism to load any Lab that has its name in this field, i.e. IndicOrganism "One" should load all Labs with "One", "One-Two", etc.
I am trying to use this sql-query
<sql-query name="labs">
<load-collection alias="lab" role="com.yum.fsraqa.model.IndicOrganism.laboratories" lock-mode="read" />
SELECT {lab.*} FROM laboratory lab WHERE lab.indic_organisms like :indicOrganism
</sql-query>
when I add the "%" around the :indicOrganism I get the error,
Line 1: Incorrect syntax near '@P0'
|