Fix for mismatching foreign id's on join

FieldType.equals() now also takes the class which is used to create the
table in consideration. Before it only used a Field object to determine
if two FieldTypes are equal. If two subclasses (B/C) inherit a field
annotated as ID from superclass A their ID FieldTypes would be equal,
which is not preferable because it could mess up joins on these IDs.