Bobby Lawrence wrote:

How does OJB handle collection references internally?
If I have an object that contains a collection of other objects, and I remove one, will OJB remove that same one from the database?

If you use that API correctly (see the tutorials), then yes, OJB with track changes to collections, etc... Typical setup is so that if you remove an object from a collection the foriegn key is removed in the DB, but the actual 'object'/row is still there unless you explicitly delete this. I can't remember off the top of my head, but I believe there is a configuration option (per-collection) to change this so a remove == a db delete.


Also - if I have a collection that contains only one object and I change the primary key, does OJB update that object or insert a new one?
I seems like the latter...


You should let OJB handle the primary (and foreign) keys for you; they end up being the items that OJB is using to track object identity, so the behavior that your seeing is not unexpected (changing the primary key essentially changes the object reference as far as the SQL portion of OJB is concerned).

--
   Robert r. Sanders
   Chief Technologist
   iPOV
   (334) 821-5412
   www.ipov.net


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



Reply via email to