This is a migrated thread and some comments may be shown as answers.

The db-optimistic-locking option may only be specified for the least derived class in a hierarchy

3 Answers 80 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tracy
Top achievements
Rank 1
Tracy asked on 21 Aug 2013, 02:30 AM
I am a beginner of OpenAccess. I created a project for studying "inheritance" according to this document:
How to: Create One-to-One Associations with Vertical Inheritance
But when I compile the project at last, it throw the error:

The db-optimistic-locking option may only be specified for the least derived class in a hierarchy
--> EntitiesModel/namespace[Sunny.Model]/class[Worker]/db-optimistic-locking="none" G:\Test Projects\OpenAccess\OpenAccessRelation\Model\EntitiesModel.rlinq 0 0 Model

Here is the content of my  "EntitiesModel.rlinq" file:

 XML Code 
<?xml version="1.0" encoding="utf-8"?>
<DomainModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="2.0.0.0" name="EntitiesModel" namespace="Sunny.Model" showPropertiesCompartment="true" xmlns="http://www.telerik.com/ORM">
  
<orm:orm name="EntitiesModel" backend="oracle" xmlns:orm="http://tempuri.org/ORM">
    
<orm:namespace name="Sunny.Model" default="true">
      
<orm:class name="Worker" inheritance-modifier="vertical" discriminator-value="Sunny.Model.Worker" uniqueId="565349f9-7460-4e1b-8f4c-1fd45e9131dd" persistent-baseclass="Sunny.Model.Person" inheritance="new-table">
        
<orm:table name="Worker" />
        
<orm:identity>
          
<orm:internal>
            
<orm:column name="PersonId" sql-type="RAW" nullable="false" length="16" scale="0" primary-key="true" ado-type="VarBinary" />
          
</orm:internal>
        
</orm:identity>
        
<orm:concurrency strategy="none" />
        
<orm:discriminator discriminator-value="Sunny.Model.Worker" />
        
<orm:field name="_Department" property="Department" behavior="readwrite" uniqueId="771d9e63-8c01-47dd-b7a7-24bc01397565" type="System.String">
          
<orm:column name="Department" sql-type="VARCHAR2" nullable="false" length="20" scale="0" ado-type="StringVariableLength" />
        
</orm:field>
      
</orm:class>
      
<orm:class name="Person" discriminator-value="{no}" uniqueId="9412ee03-0f95-414a-9039-ebcb829c7d59">
        
<orm:table name="Person" />
        
<orm:identity>
          
<orm:single-field field-name="_PersonId" />
        
</orm:identity>
        
<orm:discriminator discriminator-value="{no}" />
        
<orm:field name="_PersonName" property="PersonName" uniqueId="71975926-5f0a-4f2e-8c29-5c61b327ac0a" type="System.String">
          
<orm:column name="PersonName" sql-type="VARCHAR2" nullable="false" length="36" scale="0" ado-type="StringVariableLength" />
        
</orm:field>
        
<orm:field name="_PersonId" property="PersonId" uniqueId="c6b1f53a-685d-4396-9818-3aa6bfc4decf" type="System.Guid">
          
<orm:column name="PersonId" sql-type="RAW" nullable="false" length="16" scale="0" primary-key="true" ado-type="VarBinary" />
        
</orm:field>
      
</orm:class>
    
</orm:namespace>
    
<orm:schema schema="">
      
<orm:table name="Worker">
        
<orm:column name="PersonId" sql-type="RAW" nullable="false" length="16" scale="0" primary-key="true" ado-type="VarBinary" />
        
<orm:column name="Department" sql-type="VARCHAR2" nullable="false" length="20" scale="0" ado-type="StringVariableLength" />
      
</orm:table>
      
<orm:table name="Person">
        
<orm:column name="PersonId" sql-type="RAW" nullable="false" length="16" scale="0" primary-key="true" ado-type="VarBinary" />
        
<orm:column name="PersonName" sql-type="VARCHAR2" nullable="false" length="36" scale="0" ado-type="StringVariableLength" />
      
</orm:table>
      
<orm:table name="Child">
        
<orm:column name="ChildId" sql-type="RAW" nullable="false" length="16" scale="0" primary-key="true" ado-type="VarBinary" />
        
<orm:column name="PersonId" sql-type="RAW" nullable="false" length="16" scale="0" ado-type="VarBinary" />
        
<orm:column name="ChildName" sql-type="VARCHAR2" nullable="false" length="20" scale="0" ado-type="StringVariableLength" />
      
</orm:table>
    
</orm:schema>
    
<orm:relational-naming-settings>
      
<orm:remove-camel-case>False</orm:remove-camel-case>
      
<orm:resolve-reserved-words>False</orm:resolve-reserved-words>
      
<orm:source-strategy>Property</orm:source-strategy>
      
<orm:remove-leading-underscore>False</orm:remove-leading-underscore>
    
</orm:relational-naming-settings>
  
</orm:orm>
  
<ModelSettings xmlns="">
    
<AppConfigConnectionPropertyName>Model</AppConfigConnectionPropertyName>
    
<AppConfigConnectionString>data source="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.48)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)))";user id=TEST;password=0;enlist=false</AppConfigConnectionString>
    
<InitialCatalog>TestDatabase</InitialCatalog>
    
<NamingSettings>
      
<ClassRules>
        
<CaseMode>PascalCase</CaseMode>
        
<PluralizationMode>Singularize</PluralizationMode>
      
</ClassRules>
      
<FieldRules>
        
<AddPrefix>_</AddPrefix>
      
</FieldRules>
      
<PropertyRules>
        
<CaseMode>PascalCase</CaseMode>
      
</PropertyRules>
    
</NamingSettings>
    
<CodeGenerationSettings>
      
<OutputProjectName>Model</OutputProjectName>
      
<OutputProjectFolder>Generate\</OutputProjectFolder>
      
<OutputPath>Generate\</OutputPath>
      
<MappingDefinitionType>Xml</MappingDefinitionType>
    
</CodeGenerationSettings>
    
<SchemaUpdateSettings>
      
<AppendDateTimeStamp>false</AppendDateTimeStamp>
      
<ExecuteScript>true</ExecuteScript>
      
<DeploymentProject>Model</DeploymentProject>
      
<DeploymentDirectory>Generate\</DeploymentDirectory>
      
<UpdateDatabaseOperation>Migrate</UpdateDatabaseOperation>
    
</SchemaUpdateSettings>
    
<BackendConfigurationSettings>
      
<BackendConfiguration>
        
<Backend>Oracle</Backend>
        
<ProviderName>Oracle.DataAccess.Client</ProviderName>
        
<Logging>
          
<MetricStoreSnapshotInterval>0</MetricStoreSnapshotInterval>
        
</Logging>
      
</BackendConfiguration>
    
</BackendConfigurationSettings>
  
</ModelSettings>
  
<Types>
    
<DomainClass Id="565349f9-7460-4e1b-8f4c-1fd45e9131dd" name="Worker" namespace="Sunny.Model" showPropertiesCompartment="true" concurrencyMode="None" concurrencyMember="< AUTO >" showNavigationCompartment="true" showImplementationCompartment="true">
      
<Property Id="771d9e63-8c01-47dd-b7a7-24bc01397565" name="Department" label="Department : String" kind="Persistent" fieldName="_Department" />
    
</DomainClass>
    
<DomainClass Id="9412ee03-0f95-414a-9039-ebcb829c7d59" name="Person" namespace="Sunny.Model" showPropertiesCompartment="true" concurrencyMode="None" concurrencyMember="< AUTO >" showNavigationCompartment="true" showImplementationCompartment="true">
      
<Property Id="c6b1f53a-685d-4396-9818-3aa6bfc4decf" name="PersonId" type="Guid" label="PersonId : Guid" kind="Persistent" identity="true" fieldName="_PersonId" />
      
<Property Id="71975926-5f0a-4f2e-8c29-5c61b327ac0a" name="PersonName" label="PersonName : String" kind="Persistent" fieldName="_PersonName" />
      
<inheritors>
        
<inheritance Id="87377487-2195-4e73-b7ba-0f8178aa4f64">
          
<DomainClassMoniker name="/EntitiesModel/Worker" />
        
</inheritance>
      
</inheritors>
    
</DomainClass>
  
</Types>
  
<domainContext>
    
<domainModelHasDomainContext Id="70f6e80f-e3af-4a4c-bd1a-8e0e26feab93">
      
<domainContainer name="EntitiesModel" namespace="Sunny.Model" showPropertiesCompartment="true">
        
<entitySetProperty name="Workers" namespace="Sunny.Model" type="Worker" label="Workers : IQueryable<Sunny.Model.Worker>" />
        
<entitySetProperty name="People" namespace="Sunny.Model" type="Person" label="People : IQueryable<Sunny.Model.Person>" />
      
</domainContainer>
    
</domainModelHasDomainContext>
  
</domainContext>
</DomainModel>

Thank you for any help in advance!

3 Answers, 1 is accepted

Sort by
0
Tracy
Top achievements
Rank 1
answered on 21 Aug 2013, 07:55 AM
Have solved!
 I found that "db-optimistic-locking" is the "Concurrency Mode" property of the class in the designer.
0
Doroteya
Telerik team
answered on 23 Aug 2013, 12:21 PM
Hi Tracy,

I am glad that currently the issue is resolved on your side and additionally, thank you for the provided information.

I tested both the configuration in your .rlinq file and the workflow described in the mentioned documentation article but was not able to reproduce the error on my side. In that connection, could you please share if there are any additional steps or settings that might have been performed during the tests of the inheritance that are not described in the tutorial.

I am looking forward to your feedback.


Regards,
Doroteya
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
0
Tracy
Top achievements
Rank 1
answered on 24 Aug 2013, 01:03 AM
On my side, must set the "Concurrency Mode" of the derived class(In my codes, the  the derived class is Woker) to "Default", or will receive the db-optimistic-locking error.
The default value of the  "Concurrency Mode" is "Changed".
Tags
Design Time (Visual Designer & Tools)
Asked by
Tracy
Top achievements
Rank 1
Answers by
Tracy
Top achievements
Rank 1
Doroteya
Telerik team
Share this question
or