yes for some reason that is not clear here the entity manager is being shared by the task server and the Enviroment that is being used by the JPAKnowledgeService. I'm pretty sure that if you create to entity manager factories and two different persistence unit it will work as expected.
Cheers