If this query is performed by the delegate attached to the service task, then you are hitting a limitation of the engine. Read the following thread for details:
Hi all,
I’m having issues with the DbEntityManager from Camunda. It does not get flushed or queries do not fetch the data from the cache so it seems. I’ve tried multiple things (moving create code to a new EJB with REQUIRES_NEW transaction management) but I cannot get things to work.
I have 2 user tasks.
On the first task (NewNotification), I have a complete task listener with the following code:
User camundaUser = identityService.newUser(identifierGenerationService.getNewUserId());
…