you can not use a whole object in a criteria, you'll have to use a single attribute (ie. b.name).
hth jakob
Michael Becke wrote:
Hello,
I am wondering what is the best way to handle Criteria.addEqualTo() and Criteria.addIn() when the field contains an object referenced from another table. For example.
<class-descriptor class="A" table="TABLE_A"> <field-descriptor name="bId" column="B_ID" jdbc-type="INTEGER" access="anonymous"/> <reference-descriptor name="b" class-ref="B"> <foreignkey field-ref="bId"/> </reference-descriptor> </class-descriptor>
<class-descriptor class="B" table="TABLE_B"> <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/> </class-descriptor>
I want to be able to query A objects using something like criteria.addEqualsTo("b", <An instance of B>). When executing a query with this criteria OJB tries to bind the object B to the query instead of the B's ID. This causes an SQL exception.
Should I just be using B's ID in the criteria or is there a way to make this work.
Thank you,
Mike
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]