RE: [Objectbridge-developers] Named Roots
Brought to you by:
thma
From: <tho...@it...> - 2001-01-24 16:30:52
|
> > > I picked up a bit with the NamedRoots thing. (Check for NULL, > moved the txAbort and txCommit into doCommit, doAbort. Moved > the DbImpl declaration to the head of the file, etc.) The Named roots has been one of my feared quick hacks :-) I did not include tx support for the following reason: To have tx support for the named roots, they have to be treated as ordinary objects managed by the odmg server. So the most natural thing would be to store them in a special database table e.g. with the following DDL create table OJB_NAMED_ROOTS ( name VARCHAR NOT NULL PRIMARY KEY, oid VARCHAR ) But I was not sure if it legitimate to mix the business tables with the OJB internal tables. If we want to implement ODMG collections like DMap we also need special tables in one of the target databases. When I'm thinking about this today I don't see why this should be a problem, so I gues it would be the best thing to implement the named roots as ordinary objects managed by the default tx mechanism and map them to a special table. All we have to give to our users is a DDL script to generate the required table in their target db and a mapping in the repository XML. > > I also created three classes: > UpdateTransactionWrapper > InsertTransactionWrapper > DeleteTransactionWrapper > > These all extend ObjectTransactionWrapper (with the Update specific > stuff moved to UTW) I don't know if this collides with my approach of the ObjectStateTable and the ModificationStates (applying the state pattern here) ? > > These will be responsible for committing individual objects which > have been part of the transaction. > > As for how to do this with the broker code, I'm not sure. I would suggest rely on the following broker.beginTransaction() try { while (moreObjectsToCommit) { broker.store(nextObjectToCommit); } broker.commitTransaction(); } catch (Throwable t) { broker.abortTransaction(); } best regards, Thomas |