raise exception when save db with wrong type.