Den 8. des. 2010 kl. 03:23 skrev Rickard Öberg <[email protected]>:

> On 2010-12-08 00.03, Ronnie Nessa wrote:
>> In my application I have a re-indexer service that under certain
>> conditions reindexes the entire database when the application is
>> started ( I think I borrowed some of the code from streamflow). Also I
>> have a service that when activated conditionally bootstraps some
>> initial data. My problem is that it is important that the re-indexer
>> service runs before the bootstrap service, but as I see it they are
>> not really dependent on each other, so making them dependent would be
>> weird I think. Maybe I'm attacking this from the wrong angle though.
>> Have any of you solved a similar problem in a different way?
>
> The trick is to let your initial data bootstrap work with known Entity id's, 
> rather than doing queries. In my case I have a known Users entity, with a 
> given id, that I check for:
> try
> {
>   // Check if users entity exists
>   users = uow.get( UsersEntity.class, UsersEntity.USERS_ID );
> } catch (NoSuchEntityException e)
> {
>   // Create bootstrap data
>   users = uow.newEntity( UsersEntity.class, UsersEntity.USERS_ID );
> }
>
> /Rickard
>
> _______________________________________________

Hmm. I though I'd already done that actually. That's what I did after
the thread about changing Ids of entities and the migration APIs, if
you remember. Maybe I should have another look and see if there are
something else causing the issues I'm having.

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

Reply via email to