I'm trying to put some new functionality into an existing app that uses iBatis but I'm a little stuck with one of the design decisions.
There is an existing class (call it class A) which I want to add some new fields to. These fields will be of type B.
The query will join B via an outer join.
So it will be something like
public class A {
//... existing fields
private List<B> bList; // may use a Map rather than a list?
// etc.
}
public class B {
private int id; // primary key
private int type;
private String description;
// etc.
}
I'm using this in a web app. On the first page I want to return a list of "A's", and then put links beside for the B's.
Eg:
LinktoRecordA1 - LinktoB1 LinktoB2 LinktoB3
LinktoRecordA2 - LinktoB1 LinktoB3
LinktoRecordA3 - LinktoB1 LinktoB2 LinktoB3
LinktoRecordA4
etc.
(NB: Record A4 has no links to any B's - hence the outer join mentioned above)
In the initial fetch of the "A's", I only want to know that the B record exists, and what it's primary key is to present the link through to the B detail record. So my problem is, how do I do this without creating a fully populated list of "B's" on the "A" object?