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>


Reply via email to