Cannot use Session.Lock with Version column on abstract base class

Description

When a version column is on an abstract base class and a joined subclass is used, when trying to use Session.Lock(entity, LockMode.Force) where entity is an instance of the subclass the incorrect SQL is generated.

The statement to try and increment the version number creates an update statement with the table name for the base class as expected, but the id column name as the column name from the sub-class table.

I believe the issue is in:

  • NHibernate.Persister.Entity.AbstractEntityPersister#GenerateVersionIncrementUpdateString()

Environment

None

Assignee

Alex Zaytsev

Reporter

Richard Lowden

Labels

Components

Fix versions

Affects versions

Priority

Major
Configure