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

Reply via email to