Fix bug of getPrimaryKey