Hi Bobby. try to update the reference to the object too.
Cheers. Carlos Ch�vez. Bobby Lawrence Escribio :-) > Thanx Robert. > I am letting OJB handle the PK/FK stuff - that is the problem is seems. > I have one object, but I want to change a field...this field is a PK. I > want OBJ to update, but it inserts a new one... > --Bobby > > Robert r. Sanders wrote: > >> >> >> 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). > > > -- > ---------------------------- > Bobby Lawrence > MIS Application Developer > > Jefferson Lab (www.jlab.org) > > Email: [EMAIL PROTECTED] > Office: (757) 269-5818 > Pager: (757) 584-5818 > ---------------------------- > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Carlos Ch�vez --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
