Hi Thomas,

First of all, I'm very sorry for having posted this question to you directly, instead of to the OJB user group.
I will not make that mistake again! Sorry!


About the solution you have provided, Thomas, I can't select from Application class because I am not sure all persons
have applications. So if I select from Application, I can't get any of the Person data because the Application object
returned by OJB will be null.


What I was hoping for is a way of selecting Person objects and even if no Application objects are found, I can atleast
display the Person details in my search results page.


Can someone help! If someone has an idea would you please post it on the group/mail it to:[EMAIL PROTECTED]

Thanks and Regards

Rick Banerjee




Mahler Thomas wrote:


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



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to