Skip to end of metadata
Go to start of metadata

Motivation:

Insert features using existing FIDs

Contact:

Andrea Aime

Tracker:

http://jira.codehaus.org/browse/GEOT-3120

Tagline:

Insert using existing FIDs

Description

GeoTools data stores always generate a new feature id when a new feature is being inserted. In some cases this is a requirement, such as in Shapefiles, where the id is the feature row number in the file. In other cases it's merely an implementation choice, such as the case of property data store or the JDBC data stores.

Using the user provided feature id is a requirement in a few cases:

  • WFS 1.1 insert handling mandates the support of a useExisting policy
  • some organizations mandate a primary key generation policy for database tables
  • the primary key can be a multicolumn key whose content references other tables via foreign keys
  • the key itself has a business meaning (e.g., a social security number)

This proposal adds hints to allow:

  • a feature store to advertise the ability to use user provided feature id during inserts
  • a user to ask the feature id to be used during the import
    Neither of them requires new API, thus this proposal is targeted towards both the 2.6.x and trunk branches.

To support advertisement QueryCapabilities gets a new method:

To support uses in asking the FID to be used a new well know hint has been added, that need to be specified in the Feature user map (see example below):

Implementation wise the JDBC data stores and the property data store will be modified to support the USE_EXISTING_FID hint.

GEOT-3120 contains a full working patch to implement the above.

Status

This proposal has been implemented

Voting has not started yet:

Usage example

AFTER

The following unit tests shows checking for USE_EXISTING_FID hint support and asking the FID to be used during insertion.

Documentation Changes

The following page already documents the above (as modified by Jody):

  • No labels