On Tue, Sep 16, 2008 at 11:25 AM, Niklas Uhrberg <[EMAIL PROTECTED]> wrote: > Just look at the important case: > > Entity within Aggregate id=X -> Entity within Aggregate > id=Y is invalid > > > This is a strong constraint , probably violated by many projects and > people will in the worst case misuse Qi4J just to get around it.
Well, we need to explain how things MUST be done and have convincing arguments why it is that way. In reality, I think a lot of "PartOf" entities will be 'promoted' to "Root" entities as a result. I think it can be rather hard to figure out differences... For instance; An engine is a "PartOf" entity of Car, but the Car can change Engine and the old one goes in for reconditioning and end up in a Store for sale. Apparently, the Engine is a root entity in its own right. So, let's go back to the Order/OrderLineItem scenario. When the Order reaches the packaging people, they notice that one item is out of stock (stolen). A RestOrder is created, and often the OrderLineItem on the RestOrder will reference the original OrderLineItem, for agreed price, a reference to humans and perhaps for auditing (paper trail) purposes later. In our suggested constrained environment, we are asking that an "Aggregate Identity" (Pos) is provided by the RootEntity (Order) to such OrderLineItem. IMHO, people do it all the time in the real world. "Front left tyre of my car"... if you can't find the car, you can't locate the tyre, and if someone moves the tyres around, the "Aggregate Identity" will change for each of the actual tyres. Should such a mechanism (Identity within Aggregate) be supported intrinsically, or just as a recommended pattern? Cheers Niclas _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

