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]

Reply via email to