Sorry but when I look this :
<class-descriptor  class="B"  table="B">
    <field-descriptor  name="id"  column="ID"  jdbc-type="INTEGER"  primarykey="true"  
autoincrement="true"/>
    <field-descriptor  name="email"  column="EMAIL"  jdbc-type="VARCHAR"/>
        <reference-descriptor  name="super"  class-ref="A">
            <foreignkey field-ref="id"/>
        </reference-descriptor>
</class-descriptor>

I think your class is like this :
class B 
{
 private int id;
 private String email;
 private A super;
 
 /* getters and setters*/
} 

So, it's an agregation (also extends but where is your type A attribute in B ?) and 
you can add criteria("B.super",null)

Not sure to understand your goal ...
  ----- Original Message ----- 
  From: shibin ck 
  To: OJB Users List 
  Sent: Friday, September 12, 2003 11:38 AM
  Subject: Inheritance querying problem 



  Hi,


     i have 2 classes A and B. B inherits from A. i map classes A and B on multiple 
joined tables.

  my classes are

  class A
  {
   private int id;
   private String name;
   
   /* getters and setters*/
  }
  class B extends A
  {
   private int id;
   private String email;
   
   /* getters and setters*/
  } 

   my descriptor file is like
     
  <class-descriptor  class="A"  table="A">
      <field-descriptor  name="id"  column="ID"  jdbc-type="INTEGER"  
primarykey="true"  autoincrement="true"/>
      <field-descriptor  name="name"  column="NAME"  jdbc-type="VARCHAR"/>
  </class-descriptor>

  <class-descriptor  class="B"  table="B">
      <field-descriptor  name="id"  column="ID"  jdbc-type="INTEGER"  
primarykey="true"  autoincrement="true"/>
      <field-descriptor  name="email"  column="EMAIL"  jdbc-type="VARCHAR"/>
          <reference-descriptor  name="super"  class-ref="A">
              <foreignkey field-ref="id"/>
          </reference-descriptor>
  </class-descriptor>

  The problem is when i query on A class with null criteria .. it returns objects of A 
only
  ie
  QueryByCriteria queryOne = new QueryByCriteria (A.class, null);
  Collection col = broker.getCollectionByQuery (queryOne);

  Iterator iter = col.iterator ();
  while (iter.hasNext ())
  {
      System.out.println(iter.next().getClass());  
  } 
  this prints class A only ... (i'm getting B objects as A objects so i am able to get 
name of B objects but not  email) ..

  If i use each class in separate table (with <extent> tag) ... it is working fine 
(class A and class B are printing)

  So my question is 
   is there any way by which we can get child attributes by quering on parent class 
using <reference-descriptor name="super" ... method???

  Thanks in advance

  shibin 


  ---------------------------------
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free, easy-to-use web site design software


  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003

Reply via email to