2 Replies Latest reply: Sep 13, 2013 11:16 AM by Cdelahun-Oracle RSS

    EclipseLink Error Message 207

    bwalther

      Hello,

       

      I'm doing a migration from TopLink to EclipseLink and am running into problems with some descriptors.

       

      I'm currently receiving the following error message and I'm not sure what a likely cause could be (the descriptor worked fine with TopLink). I also have no been able to find any similar issues on Google. The exception I'm receiving is as follows:

       

      Exception [EclipseLink-207] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DescriptorException

      Exception Description: Insert table order is wrong: table [DatabaseTable(CORETOOL)] mapped to parent is specified to be inserted after table [DatabaseTable(CALENDARTOOL)] mapped to child.

      Descriptor: ClassDescriptor(com.package.witheld.CalendarTool --> [DatabaseTable(CORETOOL), DatabaseTable(CALENDARTOOL)])

       

       

      Exception [EclipseLink-207] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DescriptorException

      Exception Description: Insert table order is wrong: table [DatabaseTable(CORETOOL)] mapped to parent is specified to be inserted after table [DatabaseTable(FILETOOL)] mapped to child.

      Descriptor: ClassDescriptor(com.package.witheld.FileTool --> [DatabaseTable(CORETOOL), DatabaseTable(FILETOOL)])


      Could anyone give me more information about what causes this error message?

        • 1. Re: EclipseLink Error Message 207
          bwalther

          I'm still unsure as to the definitive reason for the exception however I have managed to resolve it for now:

           

          The exception may have to do with this:

           

          descriptor.addForeignKeyFieldNameForMultipleTable(

                      "CORETOOL.CORETOOLID", "FILETOOL.ID");

           

          and I managed to resolve it with the following code:

           

          List<DatabaseTable> tableInsertOrder = new ArrayList<DatabaseTable>();

                  tableInsertOrder.add(new DatabaseTable("FILETOOL"));

                  tableInsertOrder.add(new DatabaseTable("CORETOOL"));

                  descriptor.setMultipleTableInsertOrder(tableInsertOrder);

           

          Any insight?

          • 2. Re: EclipseLink Error Message 207
            Cdelahun-Oracle

            I believe this was changed for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=248858 in EclipseLink 1.1 so that EclipseLink would respect that when calling addForeignKeyFieldNameForMultipleTable(source, target), the target should be inserted first before the source to conform to any constraints that might exist as it does with any other source->target relationship.

             

            You can correct this by calling

            descriptor.addForeignKeyFieldNameForMultipleTable("FILETOOL.ID", "CORETOOL.CORETOOLID");

            instead, as this specifies "FILETOOL.ID" references "CORETOOL.CORETOOLID" - your errors seem to suggest CORETOOL is the main table.


            Your workaround of specifying the setMultipleTableInsertOrder gets around the check and insert order calculation.  This works likely because your database does not have a constraint set on the CORETOOL -FILETOOL relationship, so it doesn't matter which is inserted first.


            Best Regards,

            Chris