I agree with Allen.
I suspect that what's confusing Craig is the same thing that confused me
initially. There is an unconventional asymmetry in our current pattern.
The Roller interface exposes flush() but not the equivalent of begin(),
which still (always) happens but is not exposed.
Still the current pattern seems workable for JDO too. To implement the
current pattern for JDO one would create a JDOPersistenceStrategy class that
ensures that a transaction is in progress and sets up any necessary pojo
context (does the equivalent of HibernatePersistencyStrategy.getSession()
for JDO), and to call this method from the JDO manager impl methods before
doing any persistence-related work (whether reading or writing). This
method (actually the entire strategy class) can be entirely JDO-specific; it
is exposed only to impls of the same strategy and implements no generic
interface.
--a.
----- Original Message -----
From: "Allen Gilliland" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, June 07, 2006 9:25 AM
Subject: Re: Add "notify intent to update" method to Roller
Well, my first thought is "ugh".
Personally I think that suggestion is actually a step backwards. Our
current Hibernate implementation requires the same exact thing, each
operation happens within a Transaction, but we are able to begin
transactions in a lazy fashion and it's isolated within the Hibernate
implementation code so that the rest of the code isn't littered with
Roller.begin() statements everywhere.
If you look in the HibernatePersistenceStrategy class it's pretty easy to
see what I mean. Any time one of the hibernate manager impl classes
requests a Hibernate Session to do some work, a transaction is
automatically started. Check out
HibernatePersistenceStrategy.getSession()
Unless there is a *very* *very* strong reason why that can't be done in
JDO then I would much prefer that we not revert to using a Roller.begin()
method. The idea is that persistence is supposed to be transparent, and
as soon as every time you work on an object you have to wrap it in a
begin() and flush() method then that's not the case anymore =(
-- Allen
Dave Johnson wrote:
This is an interesting RFE from Craig Russell:
http://opensource.atlassian.com/projects/roller/browse/ROL-1156
Perhaps we could call this new method Roller.begin() ?
- Dave