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

4 posts, 0 answers
  1. Tracy
    Tracy avatar
    8 posts
    Member since:
    Mar 2013

    Posted 20 Aug 2013 Link to this post

    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 
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    <?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!
  2. Tracy
    Tracy avatar
    8 posts
    Member since:
    Mar 2013

    Posted 21 Aug 2013 Link to this post

    Have solved!
     I found that "db-optimistic-locking" is the "Concurrency Mode" property of the class in the designer.
  3. DevCraft banner
  4. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 23 Aug 2013 Link to this post

    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.
  5. Tracy
    Tracy avatar
    8 posts
    Member since:
    Mar 2013

    Posted 23 Aug 2013 Link to this post

    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".
Back to Top