Intersecting Load Groups
pazu Mar 14, 2002 8:21 AMHello, folks! (hello, Dain!)
I was wondering if I'm able to define intersecting load groups in JBoss 3.0.0. Here is the scenario:
I've a very large entity bean (+40 fields) and many Value Objects[1] defined for it. Each Value Object holds a different set of attributes for this entity. I've a minimal VO, two different intermediate VO's and a complete VO.
Now, I want to define load-groups based on these VO's. The problem is: those load groups will be intersecting as one is a superset of the other.
For example, the minimal load group needs description and reference. The intermediate load group needs type, price *and* the fields in the minimal load group.
I've defined the following in jbosscmp-jdbc.xml:
<load-groups> <load-group> <load-group-name>minimal</load-group-name> <field-name>description</load-group-name> <filed-name>reference</load-group-name> </load-group> <load-group> <load-group-name>intermediate</load-group-name> <field-name>type</field-name> <filed-name>price</field-name> </load-group> (...) </load-groups>
Now, when I create a intermediate VO the CMP engine does one query to fetch the minimal load group and then another query to fetch the intermediate load group.[2]
I want to make it do only one query for the intermediate load group. I can't include description and reference in the intermediate load group because that way when the minimal VO is instantiated, the intermediate load group will also be loaded.
If this is not currently supported, here goes a feature request. One load group could be defined as depending on another group. Something like this:
<load-group> <load-group-name>intermediate</load-group-name> <contained-load-groups> <load-group-name>minimal</load-group-name> </contained-load-groups> <field-name>type</field-name> <field-name>price</field-name> </load-group>
That way, everytime type or price is hit, the container will load type, price, description and reference. When description or reference is hit, description and reference will be loaded.
[1] Value Object is a concept from XDoclet. It's like a pumped up Data Objects, with the plus that they handle aggregation and composition, and you can define multiple VO's for each entity bean holding different attribute sets.
[2] The real groups are much larger than this. I've simplified things for the sake of understanding.