GeoTools
  1. GeoTools
  2. GEOT-2882

"Expose primary keys" is not provided as a factory property in JDBC data stores

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.6.3
    • Component/s: jdbc
    • Labels:
      None

      Description

      JDBCDataStore has a "exposePrimaryKeyColumns" property that allows for mapping the primary key columns as straigth attributes of a feature.
      This is something that has been requested many times by GeoServer users. Yet, GS cannot use that property because it's not exposed by the factory.

      1. GEOT-2882.patch
        40 kB
        Andrea Aime
      2. GEOT-2882.patch
        41 kB
        Andrea Aime
      3. GEOT-2882.patch
        25 kB
        Andrea Aime

        Activity

        Hide
        Justin Deoliveira added a comment -
        Patch looks good. The only very minor thing would be to rename the getPrimaryKeyColumnNames() method to just getColumnsNames() to match the other primary key "accessor" method, getNextValues(). Or make a note to rename the latter to getPrimaryKeyNextValues(). SOrry I know it is very anal but as that class grows (it is almost 4000 loc) I think it will be increasingly important to keep the methods as organized as possible.
        Show
        Justin Deoliveira added a comment - Patch looks good. The only very minor thing would be to rename the getPrimaryKeyColumnNames() method to just getColumnsNames() to match the other primary key "accessor" method, getNextValues(). Or make a note to rename the latter to getPrimaryKeyNextValues(). SOrry I know it is very anal but as that class grows (it is almost 4000 loc) I think it will be increasingly important to keep the methods as organized as possible.
        Hide
        Andrea Aime added a comment -
        Here is a revised patch. I've changed the method name as suggested.

        Doing my final tests I found two more hiccups I had to fix:
        - when a primary key is exposed there were troubles if not all of the pk attributes where extracted by the Query (propertyNames). Fixed that and added a JDBCFeatureSourceExposePkTest to keep that under check
        - primary key columns are exposed but treated read only, so we cannot make the "compulsory" in the WFS output, in fact we completely ignore them write wise. Changed the type building code to account for that (an exposed pk is nullable even if the underlying table says it's not)
        Show
        Andrea Aime added a comment - Here is a revised patch. I've changed the method name as suggested. Doing my final tests I found two more hiccups I had to fix: - when a primary key is exposed there were troubles if not all of the pk attributes where extracted by the Query (propertyNames). Fixed that and added a JDBCFeatureSourceExposePkTest to keep that under check - primary key columns are exposed but treated read only, so we cannot make the "compulsory" in the WFS output, in fact we completely ignore them write wise. Changed the type building code to account for that (an exposed pk is nullable even if the underlying table says it's not)
        Hide
        Andrea Aime added a comment -
        Sorry, forgot a refactor in the last patch, here is a final one (hopefully)
        Show
        Andrea Aime added a comment - Sorry, forgot a refactor in the last patch, here is a final one (hopefully)
        Hide
        Justin Deoliveira added a comment -
        Patch looks good.
        Show
        Justin Deoliveira added a comment - Patch looks good.
        Hide
        Andrea Aime added a comment -
        Fixed on 2.6.x and trunk
        Show
        Andrea Aime added a comment - Fixed on 2.6.x and trunk

          People

          • Assignee:
            Andrea Aime
            Reporter:
            Andrea Aime
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: