Hi,

I was investigating the use of "dirty" optimistic locking and stubled over the "optimistic-lock=all|dirty not supported for joined-subclass mappings" error.

In my specific use-case, I have only a single properties which is marked optimistic-lock="true" and this property is in the base class. Therefore I have removed the check from the JoinedSubclassEntityPersister's constructor and it seems to work.

1) Is there something I've overlooked, which might come back and bite me?

2) What would be needed to upstream the possibility of manually managing the version's value? Checking that all optimistic-lock="true" columns are in the base table? Would such a patch be acceptable?




Best Regards, David Schmitt

P.S: Here's the mapping I used for testing:
  <class name="Model" table="Model" optimistic-lock="dirty" 
dynamic-update="true">
    <id name="ID">
      <generator class="native" />
    </id>
    <property name="Version" optimistic-lock="true"/>
    <property name="Name" optimistic-lock="false">
      <column name="Name" length="16" not-null="true" />
    </property>
    <joined-subclass name="ModelChild" dynamic-update="true">
      <key column="ID"/>
      <property name="ChildName" optimistic-lock="false">
        <column name="ChildName" length="16" not-null="true" />
      </property>
    </joined-subclass>
  </class>

This is the "normal" mapping, but I cannot influence the chosen version value:
  <!--<class name="Model" table="Model" optimistic-lock="version">
    <id name="ID">
      <generator class="native" />
    </id>
    <version name="Version" />
    <property name="Name">
      <column name="Name" length="16" not-null="true" />
    </property>
    <joined-subclass name="ModelChild">
      <key column="ID"/>
      <property name="ChildName">
        <column name="ChildName" length="16" not-null="true" />
      </property>
    </joined-subclass>
  </class>-->

Reply via email to