Unless your Father has a very large number of children (as can occur in a Construction and the elements of construction in a price building system), you will find easier to get all childrens and implements two business methods in your Father bean: getFemaleChildrens() and getMaleChildrens().

So, you will have three ways to get the data you want, withou need to execute more than two selects on database. If you use JavaBeans based programming, when OJB call setChild, you can separate males and females, and kee each in theyr own list...

Just my 2c,

Edson Richter


[EMAIL PROTECTED] wrote:


Hi all,

Letâs say we have an object name Father, who has a Child class collection (aggregate association). With the right repository settings (autoretrieve= true etc.) every time we "load" a father from the database, the children will be instantiated (they may be proxies or materialized).

Hereâs our ignorance: when we retrieve a father we need the retrieved children collection, to be just a subset of the all fatherâs children collection. The children are those with a any given attribute set to a any given value (let say just those children with gender attribute set to female).

This is just like having a filter or criteria setting at the owned collection level.
Please pay attention to the fact we do not want to filter the fathers based in some children attributes. We need retrieve all fathers, just filtering some children.


We are aware we could retrieve the father an then iterate the collection discarding the children we do not need, but we need this to become a common feature for our classes, not just a business logic for a single app, therefore we would like to know how to handle this in general.


Thanks in advance, Gustavo Faerman.

Buenos Aires, Argentina




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



Reply via email to