Hello,
My understanding that the ODMG API is preferred over the PersistenceBroker 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.
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.
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]