Hello, I am bit confused about this ...
1 - using the PB and setting auto-update="true", is the entire object graph stored in one transaction? (it was my understanding that it was). 2 - similarly, using the PB with auto-delete="true" is the delete performed in one transaction? 3 - using ODMG is it ok to set auto-delete="true", so that the entire object graph is deleted? When I try it, it works fine, but the docs indicate not to deviate from the default settings (which would include auto-delete="false") when using ODMG. Thanks Bob c ---------------------------------------------------------------- Bob Celestino SAS Research and Development 919 - 531 - 9425 [EMAIL PROTECTED] SAS - The Power to Know > -----Original Message----- > From: Mahler Thomas [mailto:[EMAIL PROTECTED] > Sent: Friday, November 14, 2003 7:18 AM > To: 'OJB Users List' > Subject: RE: PB vs ODMG > > > Hi Gary, > > > Is there information available as to why one must not > > use auto-update with ODMG? > > The difference between PB/ODMG regarding auto-update is > documented here: > http://db.apache.org/ojb/tutorial3.html#setting%20load-,%20u > pdate-%20and%20d > elete-cascading > > The reason for this is simple. > ODMG provides transparent persistence for complete Objects > graphs. If an Object A is locked by an ODMG transaction, > all associated objects get also registered into the transaction. > > If a change to such an associated objects happens within > the transaction, the ODMG transaction mager is responsible > to detect it and to perform the appropriate PB calls to make the. > > If you set auto-update to true the PB performs store > operations for all elements of an 1:n association on > storing the 1-side instance. > > So if you use ODMG *and* auto-update="true" persistence > operations like inserts and updates will be performed > twice. In case of inserts this may lead to primary key violations. > > cheers, > thomas > > > > > > Thanks, Gary > > > > --- Robert J Celestino <[EMAIL PROTECTED]> > > wrote: > > > Thomas, > > > > > > Thanks very much. I am very happy with the PB api, > > > and prefer the query style so I will be happy to > > > stick with PB. Until I switch to JDO :-) > > > > > > You were right about the "auto-update" as well. > > > > > > Thanks! > > > Bob c > > > > > > > > ---------------------------------------------------------------- > > > Bob Celestino > > > SAS Research and Development > > > 919 - 531 - 9425 > > > [EMAIL PROTECTED] > > > > > > SAS - The Power to Know > > > > > > > > > > -----Original Message----- > > > > From: Mahler Thomas > > > [mailto:[EMAIL PROTECTED] > > > > Sent: Thursday, November 13, 2003 4:05 AM > > > > To: 'OJB Users List' > > > > Subject: RE: PB vs ODMG > > > > > > > > > > > > Hi Roberto, > > > > > > > > > Hello, > > > > > > > > > > My understanding that the ODMG API is > > > preferred over the > > > > > PersistenceBroker in production. > > > > > > > > The PB API is quite mature and it's absolutely > > > fine to use > > > > it in production. The ODMG API is build on top > > > of PB. So > > > > how could the ODMG API be "better" for > > > production? > > > > > > > > It really depends on your API requirements if > > > you chosse > > > > PB, ODMG, OTM or JDO as your API. If you feel > > > fine with the > > > > PB API there is no reason not to use it in > > > production. > > > > > > > > > To that end I have been > > > > > converting a fair amount of code (that is > > > currently working > > > > > using the PersistenceBroker API) to the ODMG > > > API. > > > > > > > > > > The code works perfectly using the PB API. So > > > I assume that > > > > > the mappings and configurations are correct. > > > > > > > > There are some subtle differences in the mapping > > > of > > > > Reference and collection descriptors. You must > > > not use > > > > auto-update="true" in an ODMG based app! > > > > > > > > > > > > > > The simplest case that I can describe is this: > > > > > > > > > > > > > > > omdg = OJB.getInstance() ; > > > > > db = _omdg.newDatabase() ; > > > > > db.open( "default", > > > Database.OPEN_READ_WRITE); > > > > > Transaction tx = omdg.newTransaction() ; > > > > > Person person = new Person() ; // creates > > > default with > > > > > default addr, etc > > > > > tx.begin() ; > > > > > tx.lock( person, Transaction.WRITE ) ; > > > > > tx.commit() ; <---- throws SQL Exception > > > > > > > > > > The exception that is thrown is "duplicate > > > entry for key" > > > > > (note the table is empty) > > > > > > > > > > I did write my own SequenceManger. But it > > > works flawlessly > > > > > using the PB API. > > > > > > > > > > The corresponding code (that works) is here: > > > > > // include the user and password here: > > > > > PBKey pbKey = new PBKey( "default" ) ; > > > > > broker = > > > > > > > > > > PersistenceBrokerFactory.createPersistenceBroker(pbKey); > > > > > // 1. open transaction > > > > > broker.beginTransaction(); > > > > > // 2. make the new object persistent > > > > > broker.store( person ) ; > > > > > broker.commitTransaction(); > > > > > > > > > > More information: > > > > > If I comment out the reference-descriptor and > > > > > collection-descriptor in the > > > repository_user.xml the store > > > > > works (but of course I get no relationships). > > > However the > > > > > update does not work. If I change the name of > > > the person and > > > > > store it again the database is not updated. > > > > > > > > try to set auto-update="false" in the reference-descriptor > > > > and collection-descriptor > > > > > > > > cheers, > > > > Thomas > > > > > > > > > > > > > > I must be missing something ... > > > > > > > > > > Thanks > > > > > Bob c > > > > > > > > > > > > > > > ---------------------------------------------------------------- > > > > > Bob Celestino > > > > > SAS Research and Development > > > > > 919 - 531 - 9425 > > > > > [EMAIL PROTECTED] > > > > > > > > > > SAS - The Power to Know > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------ > > > > --------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------ > > > > --------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > ------------------------------------------------------------ > --------- > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > __________________________________ > > Do you Yahoo!? > > Protect your identity with Yahoo! Mail AddressGuard > > http://antispam.yahoo.com/whatsnewfree > > > > > ------------------------------------------------------------ > --------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > ------------------------------------------------------------ > --------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
