support for legacy primary keys, type safe primary key code