You're right. Didn't remember that this won't be executed before acquiring locks... And only tested whether the right databases are determined. I don't find a more appropriate place to call the code as I need access to the query context. Using the visitor is not possible because

- We should have separate read/write locks (could be extended though)
- It could terminate before asking the java module what it needs to lock (if a global read lock occurs) - and this cannot be worked around the way the visitor is build but by never stopping the evaluation early (only returning true if we need a global write lock, which is the largest lock available anyway).