Rickard Öberg-3 wrote:
> 
> Here's an example from my code:
> {
>     SelectedLabels.Data selectedLabels = QueryExpressions.templateFor( 
> SelectedLabels.Data.class );
>     Query<SelectedLabels> labelUsages = qbf.newQueryBuilder( 
> SelectedLabels.class ).
>           where( 
> QueryExpressions.contains(selectedLabels.selectedLabels(), label )).
>           newQuery( uowf.currentUnitOfWork() );
> 
>     for (SelectedLabels labelUsage : labelUsages)
>     {
>        labelUsage.removeSelectedLabel( label );
>     }
> }
> 
> I.e. if you know that you have a ManyAssociation to an entity, in this 
> case SelectedLabels.Data.selectedLabels(), then make a query for it 
> using the contains() operator. Once you have found all such references, 
> invoke domain methods to do the remove automatically.
> 

Thanks, Rickard! It took me a while to understand how to properly
enable querying and that configuring it is so easy with the help of
RdfMemoryStoreAssembler. But now that it works, I really like Qi4j's
approach to querying!



> Do NOT under any 
> circumstances make this more "automated" than that, as you may then 
> violate domain rules. This is a convenience for doing it the right way, 
> rather than just changing the data "under the hood".
> 

I agree. I'm just starting with Qi4j and my thinking is probably spoiled
with the way the Eclipse Modelling Framework approaches things like
updating references and removing elements. It's all done automatically
there, which, as you mentioned, can have problematic consequences.

Thanks,
Frank
-- 
View this message in context: 
http://old.nabble.com/SideEffects-for-Properties-tp31811808p31868383.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

Reply via email to