more elegant type handling for database objects