Fix bug cannot find the ID which is a number.

Add more test for  different data type of primary key.
Only find the entity when passing an object if the object respond to `id` method