Fix for #11

Error with entity that has a primary and foreign key on the same field