> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Emile
>
> // Add a related step - field taxonomy.
> MMObjectBuilder taxonomy =
> mmbase.getBuilder("data_field_taxonomy");
> BasicStep step2a = query.addStep(taxonomy);
> BasicRelationStep step2 =
> query.addRelationStep(insrel, taxonomy);
> step2.setDirectionality(RelationStep.DIRECTIONS_DESTINATION);
>
> // Add a related step - banks.
> MMObjectBuilder banks = mmbase.getBuilder("banks");
> BasicStep step4a = query.addStep(banks);
> BasicRelationStep step4 =
> query.addRelationStep(insrel, banks);
> step4.setDirectionality(RelationStep.DIRECTIONS_DESTINATION);
This should be:
// Add a related step - field taxonomy.
MMObjectBuilder taxonomy =
mmbase.getBuilder("data_field_taxonomy");
BasicRelationStep step2 = query.addRelationStep(insrel,
taxonomy);
BasicStep step2a = (BasicStep) step2.getNext();
step2.setDirectionality(RelationStep.DIRECTIONS_DESTINATION);
// Add a related step - banks.
MMObjectBuilder banks = mmbase.getBuilder("banks");
BasicRelationStep step4 = query.addRelationStep(insrel, banks);
BasicStep step4a = (BasicStep) step4.getNext();
step4.setDirectionality(RelationStep.DIRECTIONS_DESTINATION);
The idea is that the join is created by addRelationStep(), which adds
both the relationstep and the step for the joined table. If you need to
access the latter, you can retrieve it afterrwards using getNext() on
the relationstep.
Codesamples can be found in the documentation here:
http://www.mmbase.org/mmdocs/backenddevelopers/dbsq.html
Note that the same API's can also be accessed using the
org.mmbase.bridge.* interfaces.
Rob van Maris
Technical Consultant
Quantiq
xmedia & communication solutions
Koninginneweg 11-13
1217 KP Hilversum
T +31 (0)356257211
M +31 (0)651444006
E [EMAIL PROTECTED]
W http://www.quantiq.com