On 2010-12-29 19.03, Niclas Hedhman wrote:
I think that every concept you describe is a 'work-around' to "give me
the current [left-front-tyre]" concept.

But I think that you triggered enough thinking... I am actually not
interested in "local identities" but "local identity references". If
we go back to the Car and Tyre. [left front tyre] is a local identity
reference only valid in the Car context. The identity of the Tyre
doesn't change, it follows the Tyre. What I called 'local identity' is
actually the reference, and for the simple associations, this already
exist;

Association<Tyre>  leftFrontTyre();

So, I guess I am actually wanting is a dynamic entity reference
system, type-safe of course. And we have touched on it many times in
the past, but never managed to nail it. So, I think that time has
come.

So basically it's the MapAssociation thing? I.e.:
MapAssociation<String,DividendStream> streams();

This is reasonably straightforward to support persistence-wise (at least for JSON-based persistence), but the issue is that to do a lookup in the actual association requires us to load the entire map. If the state is cached this is not so much of an issue, but if not, will be more expensive than doing a Query.

Unless you do both, i.e. have the MapAssociation as above, and make it queryable: qbf.newQueryBuilder(DividendStream.class).where(key(template.streams(), "somename")).newQuery(uow);

Then modeling-wise it looks good, and you can still use queries for direct access.

We would probably have to make some restrictions on what to use as key though, but that's manageable.

/Rickard

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

Reply via email to