Niclas Hedhman wrote:
>
> I am not sure I can follow your text well enough (code would be better).
>
Right, I should have posted code in the first place. Here it is; it boils
down to:
~~~~~~~
public interface A extends EntityComposite {
@Aggregated
Association b();
}
public interface B extends EntityComposite {
}
// test
// 1. Create b1, a1, let a1 reference b1
UnitOfWork uow = uowf.newUnitOfWork();
B b1 = uow.newEntity(B.class, "b1");
EntityBuilder ab = uow.newEntityBuilder(A.class);
A aPrototype = ab.instance();
aPrototype.identity().set("a1");
aPrototype.b().set(b1);
A a1 = ab.newInstance();
uow.complete();
// 2. Remove b1 and check a1's reference to b1
UnitOfWork uow = uowf.newUnitOfWork();
B b1 = uow.get(B.class, "b1");
uow.remove(b1);
A a1 = uow.get(A.class, "a1");
b1 = a1.b().get(); // fails with NoSuchEntityException: Could not find
entity (b1)
uow.complete();
// 3. Check a1's reference to b1 after calling uow.complete and creating a
new one
A a1 = uow.get(A.class, "a1");
b1 = a1.b().get(); // fails with NoSuchEntityException: Could not find
entity (b1)
~~~~~~~
Thanks a lot,
Frank
--
View this message in context:
http://old.nabble.com/SideEffects-for-Properties-tp31811808p31836469.html
Sent from the Qi4j-dev mailing list archive at Nabble.com.
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev