Why is the versionColumn in SQLContainer read-only?

I tried to set my versionColumn to the current timestamp like this

[code]
//tq is a table query
tq.setVersionColumn(“lastchange”);

//fg is a fieldgroup
Property pd = fg.getItemDataSource().getItemProperty(“lastchange”);
pd.setValue(new Date());
[/code]…but this causes a

com.vaadin.data.Property$ReadOnlyException: Cannot set value for read-only property.

The reason for this is that
TableQuery assumes that the database will take care of updating the version column by either using an actual VERSION column (if supported by the database in question) or by a trigger or a similar mechanism.

(
see Vaadin book
)

Or, more technical, in com.vaadin.data.util.sqlcontainer.SQLContainer [currently in line 1233):

if (queryDelegate instanceof TableQuery) { if (rsmd.getColumnLabel(i).equals( ((TableQuery) queryDelegate).getVersionColumn())) { readOnly = true; } } I cannot grasp why the field hast to be read-only, just because it is a versionColumn. Of course you
can
leave it to the database to update that column, but why not allow the app set a value for this field?

Vaadin still could do

UPDATE mytable SET foo=:bar, lastChange = :myNewValue WHERE lastChange != :savedOrigValue The only reason I can think of is to protect people from writing values into fields that
might get
overwritten by a trigger, but the price to pay for that safeguard is to either force the developer (i.e. me) to use triggers, or to abstain from using opportunistic locking. I think that price is too high.

Am I missing something?

I can only guess that the thrower of an optimistic lock exception wants to be sure that’s what’s happened, rather finding a version change caused for unknown reasons. (?)