Hi Jakob,
I am using OJB 1.0.4 but maybe that I did not change the repository.xml.
You are right that I query for table_a. The resolve to A0 and A1 works for the
A0.key=A1.key
but not for the criteria. The
crit.addEqualTo("key",new Integer(5));
crit.addEqualTo("table_b.otherfield",new Integer(10));
is correct and uses the attribute value instead of the column name?
I will check for repository changes for OJB 1.0.4 at the documentation. Maybe
that this might help.
best regards,
Guido
Jakob Braeuchi wrote:
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 thequery,which is
build by OJB, adds "select ... from table_a A0, table_bA1where A0.key=A1.key
and key=5 and otherfield=10". The database(in mycase DB/2) reports a SQL error
which says that "key" isambiguousbecause 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]