Spectrum Spatial (SSA/LIM)

 View Only
Expand all | Collapse all

Problems while trying to edit or add new object in spatial table (SQL Server 2017) using SSA 12.2 "MI_PRINX":9999999 converts to -27009

  • 1.  Problems while trying to edit or add new object in spatial table (SQL Server 2017) using SSA 12.2 "MI_PRINX":9999999 converts to -27009

    Posted 08-30-2018 11:17

    So here is couple cases. I've got spatial table in SQL Server 2017. I created connection, namedtable (editable), namedlayer and namedmap. finally I added map to my mapconfig.

    CASE1: Editing object in SSA

    1. When i tried to edit object in SSA and save the changes I've got an error: 500 Internal Server Error. In browser developers tools in tab "network" -> "Preview" there is a message: type: "com.mapinfo.midev.service.feature.ws.v1.ServiceException",…} message:"Attempt to update readonly column MI_PRINX." type: "com.mapinfo.midev.service.feature.ws.v1.ServiceException"
    2. So I go to SQL Server Management Studio and make changes for column "MI_PRINX": Design table -> column "MI_PRINX" -> Identity Specification = No
    3. After that I can edit and save the changes.

     

    CASE2: Adding new objects in SSA

    1. After CASE1 I tried to add new object and save it in my table in SQL Server. So I created geometry and didn't fill any attributes. Then a saved my changes.
    2. Using browser developers tools in tab "Network" -> "Headers" I can see my postData: geometry, attributes (nulls) AND MI_PRINX: 9999999
    3. Using the same developers tools in tab "Network" -> "Preview" I see that the value of MI_PRINX is differnet than in "Headers": -27009. And that value (-27009) I've got in my DB Table!

    PURPOSE: it looks like that somewhere there is convertation going from 4 byte int nj 2 byte int and '999999' converts to '-27009'. I guess it is bug

    4. Then I created another one object and tried to save it in the same DB Table.

    5. I've got Error: 400 Bad Request in tab "Headers". Also I can see my postData: geometry, attributes (nulls) AND MI_PRINX: 9999999 !!!

    6. In tab "Preview" or "Response" I have message: "com.mapinfo.midev.dp.jdbc.JDBCDataProviderRuntimeException: Violation of PRIMARY KEY constraint.  Cannot insert duplicate key in object 'dbo.My_Table' The duplicate key value is (-27009).

    Also, when I see tabular results for my table in SSA I can't see MI_PRINX. BUT when I do editing or adding new record that field is available for manual inserting and editing. It is kind of weird - MI_PRINX is a Primary Key and I don't think it it good way to allow users make such changes.

    I hope you can help me to solve my problems with adding records in DB Table and tell me what I am doing wrong.

    Thank you.



  • 2.  RE: Problems while trying to edit or add new object in spatial table (SQL Server 2017) using SSA 12.2 "MI_PRINX":9999999 converts to -27009

    Employee
    Posted 08-31-2018 03:24

    Hi Alexey,

    SSA and Spectrum allow adding new records in Oracle, SQL Server, PostGIS, GeoPackage and MapInfo Tab files. As there are differences on how Oracle handles the primary key as compared with MS SQL and PostGIS server, we need to provide options for supporting both.

    As you are only concerned with SQL server, please edit the file DefaultFeatureEditingTemplate.xml available under customerconfigurations\analyst\theme\featureEditTemplates directory.

    The portion that you need to edit is -

    <primaryKey>

    <includeInInsert>false</includeInInsert>

    <hidden>true</hidden>

    <showDisabled>true</showDisabled>

    </primaryKey>

    If you have setup a different template for adding and editing attributes, the above settings will need to be updated in that template.

    For more information, please refer to the section "Configuring the feature edit/insert validation form" at http://support.pb.com/help/analyst/12.2/admin_guide/en/index.html#appendix/appendixE.html

    Regards,

    Vishwas