Generic Relations and Primary Keys not being of type int

This references #204.

Here is my patch fwiw.