@ Niclas:
Creating VanillaContext is supposed to assembly the application and
start it, so it is possible to set contextual fragments then.
It is true that state transfer boundaries are important, however I
wanted for Qi4j-agnostic (thanks for good term, Rickard) code to
ignore that aspect too. Guess it's not possible.
@ Rickard:
Yeah, I was hoping that if I had an entity reference, say from
previous UoW, Qi4j would still at least invoke concerns for it when
client code invoked some method on it.
Perhaps word "proxy" would be better than "wrapper". But let's assume
we have this kind of structure:
EntityA has association to EntityB. We have actual entities for
EntityA and EntityB:
public interface EntityAComposite extends EntityA, EntityComposite,
same for EntityB, and additionally proxies for EntityA and EntityB:
public interface EntityAProxy extends EntityA, TransientComposite,
same for EntityB. Now, it is possible to ask from EntityB, if specific
EntityA is pointing to this EntityB, using Query. Yes, a little
pointless in this small example, but in real life this situation or a
variation is likely. Let's now assume we have some client, which has
following situation:
client --> EntityB (proxy) --> EntityB (actual entity)
client --> EntityA (proxy) --> EntityA (actual entity)
Now, when client does myEntityB.isAPointing(myEntityA), the code in
EntityB will need to dereference the myEntityA, in order to use it in
QueryBuilder. So far, I seem to have two choices:
1. Create service, which maintains a two-directional mapping between
each instance of entity and each instance of transient proxy.
Error-prone, memory-consuming, tedious to implement (or at least dull).
2. Pollute EntityA and EntityB interfaces with methods "EntityA
getEntity()" and "EntityB getEntity", respectively. The "isAPointing"
method would then just use myEntityA.getEntity() to pass onto
QueryBuilder.
If there is some other way to solve that problem, I would be
interested to know.
Additionally, @ Rickard:
The factories were just used as example in elaborating general issue.
And it is possible to have a reference to entity from old UoW, so when
you try access it, it goes boom. That's what I meant there.
Using constraints was just "dirty hack" way of doing the automatic UoW
setup and committing. But it is true what Niclas said, maybe
auto-commit thing isn't so good. I am also more inclined to proxy
functionality, but dereference -issue is annoying.
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev