Hi Thomas Kaske,
1. You are right. The object in memory knows always about the pk in the database, that is the only way we can find the same row in update and delete cases. With this id/pk in memory we also make sure that the data is loaded only once per object scope. We have a weak reference list per scope that takes care about that.
2. The enhancer replaces all direct read and write access to persistent fields by a method call. In this method call we mark a field as dirty (and keep the original value if the CC mode is changed) during write and load the data during read if the data is not yet loaded. In scope.txn.commit we collect all those dirty information, plus new and delete and generate the insert, update and delete statements.
3. It depends which CC mode you are using. In changed mode we only check the values of the dirty fields, in version field mode we have a special counter column that we check. The result for you is an optimistic CC exception which has a reference to the failing object.
the Telerik team