toplink

A non-read-only mapping must be defined for the sequence number field


I am getting the following error from Toplink when I start my application. I am trying to add two new tables to our application.

EXCEPTION [TOPLINK-41] (TopLink - 9.0.3.7 (Build 440)): oracle.toplink.exceptions.DescriptorException EXCEPTION DESCRIPTION: A non-read-only mapping must be defined for the sequence number field. DESCRIPTOR: Descriptor(icis.cr.common.db.entities.ClerkReviewTask --> [DatabaseTable(CREV_TASK)])

I have compared the mappings to one that works and haven't noticed anything. I compared the new Class in TopLink workbench and don't see any missing mapping. It appears my sequence is mapped correctly. Does anyone have any suggestions with this?

The descriptor has the following for the TASK_ID field:

<primaryKeyFieldHandles>
        <FieldHandle>
            <table>CREV_TASK</table>
            <fieldName>TASK_ID</fieldName>
        </FieldHandle>
    </primaryKeyFieldHandles>

    <sequenceNumberName>SEQ_CREV_TASK_ID</sequenceNumberName>

        <sequenceNumberFieldHandle>
            <FieldHandle>
                <table>CREV_TASK</table>
                <fieldName>TASK_ID</fieldName>
            </FieldHandle>
    </sequenceNumberFieldHandle>

            <Mapping>
                <descriptor>icis.cr.common.db.entities.ClerkReviewTask.ClassDescriptor</descriptor>
                <usesMethodAccessing>false</usesMethodAccessing>
                <inherited>false</inherited>
                <readOnly>false</readOnly>
                <getMethodHandle>
                    <MethodHandle emptyAggregate="true">
                    </MethodHandle>
                </getMethodHandle>
                <setMethodHandle>
                    <MethodHandle emptyAggregate="true">
                    </MethodHandle>
                </setMethodHandle>
                <instanceVariableName>id</instanceVariableName>
                <defaultFieldNames>
                    <defaultFieldName>direct field=</defaultFieldName>
                </defaultFieldNames>
                <fieldHandle>
                    <FieldHandle>
                        <table>CREV_TASK</table>
                        <fieldName>TASK_ID</fieldName>
                    </FieldHandle>
                </fieldHandle>
                <classIndicator>BldrDirectToFieldMapping</classIndicator>
        </Mapping>

Solution

  • I was able to fix this by right-clicking my project in TopLink Mapping Workbench and selecting Export Project to Java Source. My file was out of date and caused this error and the following:

    EXCEPTION [TOPLINK-110] (TopLink - 9.0.3.7 (Build 440)): oracle.toplink.exceptions.DescriptorException

    EXCEPTION DESCRIPTION: Descriptor is missing for class [icis.cr.common.db.entities.ClerkReviewCaseTask].

    MAPPING: oracle.toplink.mappings.OneToManyMapping[caseTasks]

    DESCRIPTOR: Descriptor(icis.cr.common.db.entities.ClerkReviewTask --> [DatabaseTable(CREV_TASK)])