Typed static queries

I'm opening this PR so we can discuss the current state of the implementation.
Hm, I remember talking to @eed3si9n about this when we had the same problem with getting the database drivers onto the compiler classpath. Adding a dependency in the "compile" scope was enough for that. Maybe a similar approach could work here, i.e. adding the resources dir to that classpath.