Consistency Exception..

27 views
Skip to first unread message

Stephane Le Dorze

unread,
Nov 11, 2009, 11:25:53 AM11/11/09
to fenix-framework, regis.je...@mimesis-republic.com, damian....@mimesis-republic.com
I ask this prior to investigation (trying to save time)

What is the semantic of a failing transaction?
I mean; If I've defined some predicates to an object and during a commit, one of those fail and I catch the exception in a surrounding Try/Catch.

It appears the transaction is still open.
Can I continue safely to work with it or not?

Any (even quick) feedback is Highly welcome!

Thanks!
Stephane

Joao Cachopo

unread,
Nov 11, 2009, 3:13:50 PM11/11/09
to fenix-f...@googlegroups.com
Stephane Le Dorze <stephane...@gmail.com> writes:

> I ask this prior to investigation (trying to save time)
>
> What is the semantic of a failing transaction?
> I mean; If I've defined some predicates to an object and during a
> commit, one of those fail and I catch the exception in a surrounding
> Try/Catch.

That means that you're managing the commit yourself, rather than using
the Atomic annotation, right?

So, you're doing something like:

try {
Transaction.commit();
} catch (ConsistencyException ce) {
do something...
}

> It appears the transaction is still open.

Yes, the commit does not abort the transaction on failure, precisely
because you may want to inspect the current transaction's state.

> Can I continue safely to work with it or not?

You may continue to work inside the transaction, yes. You'll see
whatever was done inside the transaction. Actually, even though I'm not
entirely sure about this one as I would have to check it better, you may
even be able to fix the problem and try to commit again the transaction
and succeed.

Best regards,
--
João Cachopo

Stephane Le Dorze

unread,
Nov 11, 2009, 3:16:55 PM11/11/09
to fenix-f...@googlegroups.com
Ok; that's what I thougth; I will try to reuse it.
Thanks!
Stephane

Stephane Le Dorze

unread,
Nov 11, 2009, 3:35:18 PM11/11/09
to fenix-f...@googlegroups.com
A side note on this.
In the context of an editor; I writing some custom consistency predicates with more domain specific information to guide the user.

"It would be nice" to have a helper function that - on request and not in the general case - could check all predicates and return a collection owning all consistency exceptions.

It helps the user to see all errors rather than one by one and I think it could also help more broadly during development.

Stephane
Reply all
Reply to author
Forward
0 new messages