On Mon, Oct 27, 2008 at 6:05 PM, Niclas Hedhman <[EMAIL PROTECTED]> wrote:

> On Mon, Oct 27, 2008 at 4:02 PM, Richard Wallace
> <[EMAIL PROTECTED]> wrote:
>
> > And that's great for initialization.  My biggest question when using a
> > private mixin still remains: How do you do a query for Cargo (or
> > CargoEntity) when all its state is stored in CargoState?
>
> The Query subsystem operates with the same mechanisms in place for
> initialization. So,
>
> QueryBuilder<Cargo> builder = uow.newQueryBuilder( Cargo.class );
> CargoState template = QueryExpressions.templateFor( CargoState.class );
> builder.where( QueryExpressions.eq( template.origin().get().name(),
> "New York" ) );
> Query query = builder.newQuery();
>

Aha!  Ok, that makes sense then.  I did not know that was possible.  That
clears up a lot of questions for me then.  While I still prefer to keep my
actual domain object interfaces, like Cargo, free of Qi4j specific classes
like Property and Assocations, the other reason I want to do this and hide
the actual state in a separate CargoState mixin is because we can make a
Property as @Immutable, but there are no compile time errors if someone were
to try and set that property.  I think that and the framework specific
interfaces (yes, I still prefer POJOs in spite of all that I've read in the
Qi4j docs and mailing lists and I'm sure I'm not the only one willing to let
go of that bias) are my last complaints about the Qi4j way of defining
Properties and Assocations.


>
>
> As is mentioned in DDD, clients should not be given free reign of
> query. Whether or not (and how) we should enforce that clients can't
> access the templates for the private mixins is another story.
>

Yes, I would definitely hide that sort of thing behind a Repository.

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

Reply via email to