hi guido,
i assume that you query for instances of table_a. in this case ojb
should resolve 'key' to 'A0.key' amd 'otherfield' to 'A1.otherfield'.
what version of ojb are you using ? inverse-foreignkeyfield-id-ref
looks rather old to me ?
jakob
Guido Beutler schrieb:
Hi Jakob,
here is a sample, I can not post the original code, sorry.
what I am doing I now:
crit.addEqualTo("key",new Integer(5));
crit.addEqualTo("table_b.otherfield",new Integer(10));
The problem now is, that "key" is a column in both table but the query,which is build by OJB, adds
"select ... from table_a A0, table_b A1where A0.key=A1.key and key=5 and otherfield=10". The
database(in my case DB/2) reports a SQL error which says that "key" isambiguous because it is a
field in table_a and table_b.
In this case "A0.key=5" would work.
Best regards,
Guido
<class-descriptorclass="table_a" table="table_a">
<object-cacheclass="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl"/>
<field-descriptorid="1"
name="key"
column="key"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
/>
<!--whatever -->
<collection-descriptorname="table_b" element-class-ref="table_b"auto-retrieve="true"
auto-update="false"auto-delete="false" proxy="false" refresh="true">
<inverse-foreignkeyfield-id-ref="1"/>
</collection-descriptor>
</class-descriptor>
<class-descriptorclass="table_b" table="table_b">
<object-cacheclass="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl"/>
<field-descriptorid="1"
name="key"
column="key"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
/>
<!--whatever -->
<field-descriptorid="2"
name="otherfield"
column="otherfield"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
/>
</class-descriptor>
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.0/304 - Release Date: 07.04.2006
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]