Fix test failures caused by null application context.
Enable QueryEventsSpec for non-hibernate datastores.
Fix test to work with hibernate.

Hibernate doesn't use datastore sessions, so make test
pass in that case.