Hello everybody,

It's been some days that I've started to use litesql and I 
wish to pose a question.

Suppose I have to map family relationships between a 
group of persons. I will use something like this to define my database:

    
<object name="Person">
        <field name="name" type="string"/>
    </object>

    <relation id="Father" unidir="true">
        <relate object="Person" limit="
many" handle="father"/>
        <relate object="Person" limit="one"/>
    
</relation>

Then I can create the Person objects: Dad, Son1 and Son2 and then 
I link them like this:

Son1.father().link(Dad)
Son2.father().link(Dad)

Now 
I'm able to retrieve each son's father ( Son1.father().get() ), but what if I 
want to retrieve every son linked to the Dad person ?
Is it possible in the 
database I've just defined or I am forced to define explicity a second 
relationship ( the 'Children' relationship ) ?

I pose this question because 
if, as it seems, I need to define the second relationship, I find this 
redundant (two relations, two tables: correct ?). I mean, if I would have to 
create this relationship in a regular database, I would have done something 
like this:

create table Dad ( id, name )
create table Son ( id, name, idDad )


Being able to retrieve the Father of each Son and, in the same time, the Sons 
of each Father:

select idDad from Son where id = xxx
select * from Son where 
idDad = yyy


Thank you


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Litesql-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/litesql-users

Reply via email to