Remove AbstractSession.objectToKey.

* Instead add a trivial method to Persister to allow fetching the id from an entity.
* Prevents potential problems with entities with overridden equals/hashCode.
Fix incorrect clearing of session attributes for entity.
Fix data corruption problem caused by proxy persistence.

Included test case which fails without fix and passes with it.
Return real entity instead of proxy where available in session.

This matches gorm-hibernate behaviour.