Diagram resource generation should only be triggered when deployment is new. If, for any reason, the generating of the diagram fails on the first deploy, there is no resource in the deployment stored. Afterwards, when the process definition is used (and not present in the cache) it's parsed internally again. Since the parsing also triggers diagram-generation (if not present as resource in DB), getting a process-definition potentially triggers the a new resource in the deployment. Although this doesn't break anything, it breaks the integrity and immutability of a deployment in the activiti-system.
So a simple query could have a side-effect of inserting in a the DB, while you expect these queries to be read-only.