Make TableQuery extensible.

This allows you to subclass it in an object instead of instantiating
a val, thus giving you a useful namespace for table-related static
features.

Coaxing type inference to do the right thing in the absence of the 2nd
(unpacked) type parameter of TableQuery required some refactoring but
in the end it looks good.

Test in MapperTest.testMappedEntity. Review by @cvogt