Dumb problem, but weâve get some confusion here.

Letâs say we have a Master object that has a Details object collection.
Details collection is a 10ths thousand objects set.
Repository settings for Master object are autoupdate true, autoretrieve 
true,autodelete true. API is PB.

Our user need to query for one specific Master object (no problem with 
this using Query object), change some attributes, then browse (paging) 
through the thousand Detail objects, until he founds the one he is looking 
for, to update some attributes in it - remember the Detail object-  (letâs 
say an iterator will do this fine) . We do not have any problems on the UI 
side.

The client app returns the data modified by the user (the Master object 
data and the Detail object data).

Back in the server, doubts start again.
Question here is, which is the right way to persist the changes to the DB?

Pseudo code seems to be:
1. Retrieve Master Object.
2. Update some attributes
3. Retrieve Detail object from the Master Object collection *
4. Update some Detail attributes
5. store de Master Object.

We find easy to retrieve the Master Object, but we do not see the proper 
way to retrieve and update the Detail object in the collection 
autoretrieved by the Master object. 
* How should we look for the Detail object? And then, how should we update 
an individual in a big autoretrieved collection? 
The mechanism available to retrieve certain object within PBAPI is the 
Query Object, but we do no see any OJB based methods to find an object in 
a autoretrieved collection.
This means we should query the Detail object outside the collection (I 
mean find the single Detail object in the DB using a Query object ) In 
this case, once we get the reference to this object and we persist it back 
(the Detail object), the in-memory collection retrieved by the Master 
object will be updated?
What if the association between Master an Detail, from a business 
perspective is a compound association? The Detail may exist or not, but 
when yes, it does so allways "compunding" a Master object, which means we 
should add him to the collection letting OJB handle the persistence 
directly?

Some code snippet might enlighten us
Thanks in advance,
Gustavo.


Reply via email to