On Tue, Feb 28, 2012 at 20:53, Vincent Massol <vincent(a)massol.net> wrote:
Hi Denis,
On Feb 25, 2012, at 1:22 PM, Denis Gervalle wrote:
On Mon, Feb 13, 2012 at 10:31, Denis Gervalle
<dgl(a)softec.lu> wrote:
Hi Devs,
I would like to commit the following change on the internal API of the
hibernate store:
Deprecate
public boolean beginTransaction(boolean withTransaction, XWikiContext
context)
public boolean beginTransaction(SessionFactory sfactory, boolean
withTransaction, XWikiContext context)
in favor of
public boolean beginTransaction(SessionFactory sfactory, XWikiContext
context)
Deprecate
public void endTransaction(XWikiContext context, boolean commit,
boolean withTransaction)
public <T> T execute(XWikiContext context, boolean bTransaction,
boolean doCommit, HibernateCallback<T> cb)
in favor of
public <T> T execute(XWikiContext context, boolean doCommit,
HibernateCallback<T> cb)
and add new method
public <T> T failSafeExecute(XWikiContext context, boolean doCommit,
HibernateCallback<T> cb)
Deprecate
public <T> T executeRead(XWikiContext context, boolean bTransaction,
HibernateCallback<T> cb) throws XWikiException
in favor of
public <T> T executeRead(XWikiContext context, HibernateCallback<T>
cb) throws XWikiException
and add new method
public <T> T executeFailSafeRead(XWikiContext context,
HibernateCallback<T> cb)
My mistake, this one should have been
public <T> T failSafeExecuteRead(XWikiContext context,
HibernateCallback<T> cb)
Reading this method name, I don't understand what it means in English.
Do you mean: executeFailSafeRead() (as in: this method executes a fail
safe read)?
It do an executeRead() in a fail safe manner, meaning it does not report
any failure in logs and does not throw anything bad, since you either do
not care, or you know it could fail and you have a plan B.
It is similar to failSafeExecute and failSafeExecuteWrite.
Putting them another way was not be so easy IMO, so I have prefered a
failSafe prefix to a more meaningful wording. If you have a better idea for
names, do not hesitate to patch this before 4.0M1 :)
Thanks
-Vincent
and I have just fixed it on master.
>
> Deprecate
> public <T> T executeWrite(XWikiContext context, boolean bTransaction,
> HibernateCallback<T> cb)
> in favor of
> public <T> T executeWrite(XWikiContext context, HibernateCallback<T>
> cb) throws XWikiException
> and add new method
> public <T> T failSafeExecuteWrite(XWikiContext context,
> HibernateCallback<T> cb)
>
> My motivation:
> - reduce confusion, since the current signature let you think that
> sub-transaction are possible, and these are not, since the
withTransaction
> argument is unused.
> - provide an easy way to run potentially failing transaction, that will
> not do logging and neither throw. It is the responsability of the
caller to
> manager the situation.
>
> The later could be use to easily check the state of the database during
a
> migration for example. Is a table exists ? is
column exists ? could be
done
> by simple fail safe selection, if these fail,
you are almost sure the
table
or column
is missing.
Anything against these changes ?
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO