When there are no relationships in config, the single table registry is
used.
And it have no functionality. Take case of below data and query -

Data -

SINGER(ID, NAME)
{1, John}
{2, Jane}

SONG(ID, TITLE, SINGERID)
{10,'Song1' ,1}
{20, 'Song2',1}
{30, 'Song3',2}

Query -
SELECT SINGER.ID, SINGER.NAME, SONG.ID, SONG.TITLE FROM SINGER, SONG WHERE
SINGER.ID = SONG.SINGERID

So,
[1]in no relationship case this data and query results in 3 SINGER
DataObjects
and 3 SONG DataObjects.

[2]Where as when there is relationship defined between
SINGER and SONG, the result is 2 SINGER DataObjects and 3 SONG DataObjects.

<Relationship name="sings" primaryKeyTable="SINGER" foreignKeyTable="SONG"
many="true">
    <KeyPair primaryKeyColumn="ID" foreignKeyColumn="SINGERID"/>
 </Relationship>

Why are we treating [1] in a way different than [2] and giving
extra/duplicate DataObjects
in case of [1]?

Regards,
Amita

Reply via email to