Andrea Aime wrote:
> This limitation is specific of shapefiles, GeoServer expects the 
> datastore to be able and provide a valid FID upon insertion, but 
> shapefiles cannot determine the proper fid until the transaction is 
> closed and the shapefile rewritten (Jody, I remember you talking about 
> this "grab the fids after transaction commit" policy, but I actually 
> cannot find a datastore independent API to grab the fids after the 
> transaction has been committed...)
Actually a few other DataStores have this limitation; ArcSDE for example 
- which is one of the reasons I have been working hard with Gabriel to 
see this issue addressed. As you indicated PostGIS is one of the only 
sane choices here just because the amount of testing.

Andrea here is how you get the correct FeatureIDs after a commit 
(responding on the devel list here):
1. Remember the Feature IDs generated as you insert the features; If 
possible grab the actual FeatureId returned by the feature event
2. When the commit event goes out ...
- you can see the Set of actual FeatureIds generated
- any FeatureIds you held onto will have their internal String updated 
with the correct value

Finally there is an open "bug" here 
(http://jira.codehaus.org/browse/GEO-91) to consider making 
Feature.getID() return a FeatureId; in a similar fashion it would be 
nice to make the insert operation return complete FeatureId objects 
rather than a String. The trick with listening to an event is just 
because we got tired of talking about the problem with a cranky 
geotools-devel list :-)

Perhaps when Gabriel returns from Holiday we can talk about this again? 
Or if you like GEO-91 we could do so now ... it has the attraction that 
any Feature you remembered as part of inserting would be smoothly 
updated. It is tempting to put a flag on FeatureId so you can tell if 
the ID is unassigned or not finalized yet.
Jody
> Nicolas, if you want to successfully perform transactions you should  
> use a JDBC based datastore, with tables having a primary key, 
> preferrably of auto-increment type.
> If you want it to be completely OGC compliant you should in particular 
> use PostGIS along with "serial" keys, that's what we use to 
> successfully pass all the OGC complicance test, none of the other 
> datastores and configuration is tested that much.
>
> Cheers
> Andrea


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to