DATAJPA-396 - Fixed potential multi-threading issues in PartTreeJpaQuery.

The CriteriaQuery implementations unfortunately is not thread-safe for some persistence providers. E.g. Hibernate changes the state of it's implementation during the first attempt to use the instance. This causes multi-threading issues if we cache the query instance for later usage (as the instance might be used concurrently).

We now synchronize the first usage of the cached CriteriaQuery instance to guard against this situation.