Queries over entities using table per subclass approach