Here's the code:
Code:
public class ManualMatcherFacade {
private static final String QUERY = ...;
protected Session session = null;
protected Iterator iterator;
public ManualMatcherFacade() {
try {
session = PersistenceLayer.getInstance().getSession();
iterator = EntityManager.genericIterator(session, QUERY);
} catch (DataException e) {}
}
public static void main(String[] args) throws Exception {
ManualMatcherFacade m = new ManualMatcherFacade();
for (int i=0; i<10; i++) {
// for each possible vendor
Object[] o = (Object[]) m.next();
Integer key = (Integer) o[0];
NormalizedVendor vendor = NormalizedVendorManager.findByPrimaryKey(key);
System.out.println("Size: " + vendor.getComparisonResults().size());
}
}
And that's the mapping of the set in NormalizedVendor:
Code:
<set name="comparisonResults" table="ETL2_MAP_VENDOR_CR" lazy="true">
<key>
<column name="VENDOR" not-null="true"/>
</key>
<many-to-many class="com.degussa.spr.dw.common.data.ComparisonResult">
<column name="RESULT" not-null="true"/>
</many-to-many>
</set>
[/code]