Hi shibin,

Maybe I'm restating the obvious, but if A is concrete and B extends A,
why should a query for A objects return B objects?  If you do not define
B to be an extent of A, the query should not return B objects.  Have you
tried using the "super" reference descriptor to define the mapping
strategy *and* define B as an extent to add it the query domain of A?

IMO OJB should function this way to make the query domain of a class
customizable.

Just my .02 worth

Wally

 
-----Original Message-----
From: shibin ck [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 13, 2003 6:14 AM
To: OJB Users List
Subject: Re: Inheritance querying problem 

Hi,
    Thank you very much for replying.     
     Actually my problem is not of aggregation, its of inheritance. B is
inheriting from A. You need not have an attribute of A in B for this.  
the "super" attribute in reference descriptor is not an actual attribute
of B , but it is used to inform ojb that A is the super class of B
 
here is a snip from  http://db.apache.org/ojb/tutorial3.html        (
Advanced Object Relational Mapping techniques --->  mapping inheritance
hierarchies ---> mapping classes on multiple joined tables)
=============================================
As you can see from this mapping we need a special reference-descriptor
that advises OJB to load the values for the inherited attributes from
class A by a JOIN using the (B.id == A.id) foreign key reference.

The name="super" is not used to address an actual attribute of the class
B but as a marker keyword defining the JOIN to the baseclass. 
==============================================
 
This strategy is one of the three strategies used for mapping
inheritance hierarchies to tables. I get objects of both A and B when
queried on class A  If i use other strategies (using <extent-class> tag)
. But when i use "super" method , i only get A objects (B objects are
stripped to A so i dont get B's attributes).
Since table structures are already decided in our project, we have to
use "super" method.
 
Again my goal is to query on A.class to retrive objects of both A.class
and B.class
 
Thanks
shibin
 

LAURENT Stephane <[EMAIL PROTECTED]> wrote:
Sorry but when I look this :


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 ...


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to