Quoting Rickard Öberg <[email protected]>:
On 2010-02-08 03.05, Stanislav Muhametsin wrote:
I have an entity, which has a mixin implementing Initializable
interface. Now, when querying the entitystore for that entity, the
initialize() method of that mixin does not get called on entities,
returned by query. Is this on purpose? Somehow, I expected it to be
called even then. Otherwise I do not see much difference between
Initializable and Lifecycle interfaces for entity mixins.
I implemented a testcase for Initializable, and I think I know what
the problem is. Mixins in entities are lazy-loaded, and so you won't
get a call to initialize() until you call a method on the mixin that
you found using a query. So, I'm guessing you just did a query, got
some entities returned, but no initialize() calls. Which is correct.
Is that an accurate description of your case?
Hi,
thanks Rickard for implementing test case. I am not familiar with Qi4j
testing system at all at the moment. Also, I didn't know I could
submit JIRA issues, I thought they were not open for submitting to
everyone. Will need to look into that.
Unfortunately, I remembered that Qi4j lazy-loads mixins, and I
actually am calling a method in mixin after getting it from query. The
initialize() is still not called. I just did a little test case of my
own to verify that (I am using 1.0 version of Qi4j).
As for accurate description, it goes something like this:
Query entities.
Execute some method on them.
Return them.
Observe mixins not being called initialize().
I will look into post JIRA case when I will get time (after / during
work), that might get pretty late tho.
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev