Add id attribute if the id's type is passed in

This is to allow databases with static types to allow setting ids of
different types.