[Objectbridge-developers] OJB Dependent Collections Update Behaviour
Brought to you by:
thma
From: Sasha H. <sha...@br...> - 2001-05-29 00:00:33
|
Hi Thomas, In your last message on the subject of how OJB updates collections of dependent objects, you said: ----- Inserting newly added objects in a Collection attribute DOES work! If you call PersistenceBroker.store(), the PersistenceBroker does NOT know that you have deleted items from a collection! It does only see the actual items in the collection! If you use the PersistenceBroker API you have to implement your own tracking mechanism that detects obsolete objects and call .delete(obj) on you own. (You could add such a thing in your collections .remove(obj) method). The ODMG implementation provides an object transaction manager that does contain such a tracking. ----- I have a number of questions about this, so I'll list them one at a time... 1. Can you describe how the following case would be handled: -> Call broker.store() on A (ID:5) with collection of dependent B objects (IDs: 6, 7, 8, 9, 10) -> Subsequent broker.store() call on A (ID:5) with Bs (IDs: 8, 9, 10, 11, 12). As I understand it, in the database we would end up with A related to 7 Bs (IDs: 6 through 12), with Bs 8 through 10 updated on the second call to store(). Is this correct? 2. Why is it that the ODMG provides this collection tracking facility but the Broker does not? Isn't the ODMG interface built on top of the Broker? How would ODMG handle the above case? 3. Does ODMG recursively update/handle dependent objects (i.e.: A depends on B which depends on C)? 4. How does ODMG know/determine which dependent references/collections to update/delete if ODMG ignores the auto.delete and auto.update settings (as you had said in an earlier message)? 5. Is it possible, safe and recommended to mix-and-match the use of the Broker interface for delete operations (since it handles cascaded deletes of dependent objects) and ODMG for update and insert operations (since it handles updates on collections of dependent objects)? Is it wise to event attempt this approach? Can you forsee any potential problems? 6. Finally, I may be interested in implementing this collection tracking facility for the Broker, depending on how complex and time-consuming such an undertaking would be. Could you describe requirements (i.e.: bullet points) of how and where (in the source code) such an improvement would be made, including how other features such as Transactions, Object Cache, Descriptors, Recursive Dependencies, would be affected. Would it possible to port the ODMG functionality into the Broker? That's it for now. Thanks again. Sasha Haghani Toronto, Canada. |