On Tue, Jan 19, 2010 at 11:09 AM, Stanislav Muhametsin
<[email protected]> wrote:

> Now, what really would be great, is that when creating VanillaContext, I
> could use contextual fragments to add generic concern to all entities. These
> concerns would create UnitOfWork whenever needed prior actually entering the
> method. IE same as UnitOfWorkPropagation, but it would affect on ALL methods
> of SomeThing.

Contextual fragments can only be added before the application is started.

> That is currently not possible, as UnitOfWorkException is thrown almost
> immediately after going through constraints, if UnitOfWork is not open.
> Question is, is there some specific reason behind this? Could it be better
> policy to check for UnitOfWork only when it is really needed, ie when
> property, association, or maybe private mixin is accessed within concern?
> And of course right after concerns, if none of the concerns accessed
> entity's state in any way.

IIRC, it is thrown when any state of an entity is accessed, directly
or indirectly. It may not be obvious when such access occur.

> Of course, if there is some other simple solution to my problem, I very much
> would like to hear it. :)

I don't think you should be focusing your attention to making sure the
UoW is opened, but "How am I supposed to commit?"

State transfer boundaries should be a major concern of your
application architecture and not taken lightly. The "auto commit"
features available in many persistence solutions are actually causing
more harm than its worth.


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to