Hi,

Here's the situation I am faced with.Could anybody analyze the
situation and tell me which way to go on this?

We have a Person valueobject mapped to a Person table in the 
database.
We have an Application valueobject mapped to the Application 
table in the database.

In the Person valueobject, we've used X-Doclet tags to define an 
1:n relationship to Application valueobjects. That is, a person can 
have 0 or more applications associated with himself. So, the Person 
valueobject contains a Collection called allApplications which is 
mapped to the Application valueobject.

Now, I have implemented a search. You may search on attributes 
that are either related to the Person (such as SSN) or Application 
(such as date of submission of application).

Since a person can contain 0 or more applications, I am searching 
using a getCollectionByQuery(Person.class, ...) meaning that when 
I search, my results are a collection of Person objects that match both 
the person and application related search criteria.
[NOTE: I am using "allApplication.dateOfSubmission" type of attributes
when I want to create search criteria that relate to the application table 
and not the person table.]

Now, in the search results, I am supposed to display attributes that 
come from both the Person and the Application tables, so when getting 
the Application I have to use Person.getAllApplications().

When I do this, I get the ALL the applications belonging to the person.

What I want to do is LIMIT the contents of the allApplications Collection 
to just the applications that satisfy the search criteria.

Could you suggest a way out here?


Our current implementation is:
First query and get the collection of Person valueobjects.
Then, query on the Application table and get all applications belonging 
to this person which satisfy the search criteria pertaining to the application 
table. 
Then, set these applications (which have been obtained by a
getCollectionByQuery()) to the person's allApplication collection object:
aPerson.setAllApplications(getCollectionByQuery());

This means a database call for every person, to retrieve his applications, 
which suggests that we seem to have something wrong as far as the use of 
OJB is concerned.


Thanks and Regards

Rick




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

Reply via email to