Hi Rickard,
Thanks for your clarifications,
----- Original Message -----
From: Rickard Oberg To: [email protected] Sent: 2009-12-14 9:55
Subject: Re: [qi4j-dev] Some more questions to Qi4j
On 2009-12-12 05.00, Niclas Hedhman wrote:
6. When an entity is deleted, references to it in other persisted
entities
are immediately removed.
Incorrect-ish. The references will remain, and when you try to access
them you would either get NoSuchEntityException or perhaps a null
reference. In fact, this is an ill-defined area I think, and we should
possibly tidy the semantics up a bit. For instance;
public interface A
{
Association<B> b();
}
This means that the b() instance is not optional and may not return
null. So what should really happen? NoSuchEntityException or should we
even try to prevent the deletion to occur?
Rickard??
Access on b() should give NoSuchEntityException. It's an application error
to delete b() without properly cleaning up any usage of it. We cannot on an
infrastructural level "know" what is the correct semantics when b() is
removed. Also, trying to figure out that b() cannot be removed would be
quite expensive, and quite possibly impossible in the general case.
So, to refine your example, it should probably read; Find all Students
where student.firstname()='Anna' and contains( any( student.courses()
).name(), "Art" ).
That's actually not what he asked for. If I understood it correctly he
wants to find two types of objects in one query, i.e. both students and
courses. The Query API only allows one type of objects to be returned at a
time. If you want to do the kind of join-query you described, that would
have to be done directly on the index, and you wouldn't get Entities back,
but rather some raw data that you can use to create DTO's from, I suppose.
Yes, 'two types of objects in one query' - that's what I actually asked for.
Regards,
Eugene
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev