Hi Rick, please post further requests to the ojb user list, not to developers directly. To answer you question. If you select a person object, OJB will load all Application objects that belong to that person. You have to selct from the Application class and must use criteria that specify the person and other restricting criteria to select only certain application objects for a given user. cheers, Thomas
-----Original Message----- From: Rick Banerjee [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 7:00 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Really difficult OJB question - Help! Hello Thomas, I have a particularly difficult situation while using OJB for my project and I hope you could help me out. This is the situation: I have two tables called PERSON and APPLICATION. They are joined by the column IDN_TRACKINGNUMBER. The mapping from Person to Application is of the type 1:n, i.e. a person can have 0 to N applications. I was using broker.getCollectionByQuery to retrieve objects of type Person (which represents the table PERSON). The problem is after I retrieve Person objects, I do the following: // Criteria contains columns from both PERSON & APPLICATION searchQuery = new QueryByCriteria(Person.class, searchCriteria); Collection c = broker.getCollectionByQuery (criteria); // Iterate and retrieve Person objects. // p is the Person object retrieved. // Trying to get all the applications that this Person has that match the criteria provided via searchCriteria. p.getAllApplications(); Here I must mention that the Person value-object contains a Collection called allApplication to hold all the applications belonging to a Person. But, when I make this call, I get back ALL applications although I had specified Application related search criteria in the query used to retrieve Person objects. So, I am getting every application associated with the Person in question instead of just getting back just those that satisfy the criteria that I have specified, because p.getAllApplications() makes a call to the DB and ignores all previous criteria. What can I do to retrieve just the applications that match the criteria when I call getAllApplications(). I have tried using extents, ReportQueries, and also examined QueryCustomizers. Thanks and Regards RB
