Hi all,

I need to manually set up the ID field (primary key) of a new feature, but I
can not figure out how and if there is a possibility.

In the data store connection parameters, I've set to 'true' the 'Expose
primary keys', so to see the primary key field of feature
and be able to set up it.

If I set the value of primary key attribute, GeoTools assigns a different
value to ID attribute.

This is my code:

    ...

    FeatureWriter<SimpleFeatureType, SimpleFeature> fw =
ds.getFeatureWriterAppend("DIA", transaction);

    SimpleFeature f = (SimpleFeature)fw.next();

    for (int i=0; i<objName.size(); i++) {
        f.setAttribute("ID", id);
        f.setAttribute("GEOM", geom);
    }

    fw.write();

    ...


The table is on Oracle Database.

Best regards
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to