We have the same issue. We need to send version information back to the client. We need to obtain this information before the transaction ends. As we do not know beforehand which entities might incremented versions (either explicitly by forcing an oplock somewhere or implicitly because data was added) we issue an explicit flush before obtaining the updated version information. However, this does not seem to work on newer Hibernate versions. This is a real 'pain', it falls in the same category as getting an autoincrement or identity value without having to re-read the data (which is solved by JDBC's RETURN_GENERATED_KEYS). Ie. besides obtaining the assigned identity before tx end we also need to obtain version information. |