Better logging on StaleObjectStateException: exception message with Version info

Description

If StaleObjectStateException is thrown, only entity tape and entity id are cited in exception message.

To better knows what is going on, it would be good to have versions of newer and older in exception message.

Environment

None

Activity

Show:

Frédéric Delaporte July 21, 2017 at 1:48 PM
Edited

I have now seen your attempted PR. What you try in it will just cover detached entities use cases. Merge and Update are not used when working only with entities attached to the session. By the way, your PR is not following contribution guidelines: No Jira number in commit message causing it to not appear here, no tests or tests not adapted, and PR causing some existing tests failures.

Frédéric Delaporte July 21, 2017 at 1:38 PM

The rejected state/version should still be the one you have in your session/application memory, while the state/version in database can be (and must be) retrieved with a new session.

NHibernate does not load in memory the database state to check it has not changed, it does it all in the update query, database side. The change your request would not be lightweight, while you can implement it yourself in your application by using a new session.

I do not think this feature is worth it.

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created July 20, 2017 at 7:51 PM
Updated July 21, 2017 at 1:49 PM
Who's Looking?