I'm so sorry, there are something wrong with myself, although the values
field in the feature got by writer.next() is all of null, but employing the
getAttribute() method could get the old values eventually.

That's all my fault. Thank you for you attention.

On Tue, Mar 13, 2012 at 3:43 PM, Zheng Xudong <[email protected]> wrote:

> Hi all,
>
> I'm using postgis as my spatial data store. I need to change some field in
> the database, and the new value to set depends on the old value. But I
> found that, the Feature I got using FeatureWriter.next() method with all
> null value, so I can't get the old value of some fields. Here is some code
> of mine:
>
>     DataStore dataStore = DataStoreFinder.getDataStore(params);
>     Transaction transaction = new DefaultTransaction("Modify");
>     FeatureWriter<SimpleFeatureType, SimpleFeature> writer =
> dataStore.getFeatureWriter("map", transaction);
>     while (writer.hasNext()) {
>         SimpleFeature feature = writer.next(); // The feature get here
> with null values, I hope it contain the old values.
>         // Something to modify the feautre
>         writer.write();
>     }
>     transaction.commit();
>     transaction.close();
>     writer.close();
>
> How can I get the old values before I want to write to data store?
>
> Thanks in advance.
>
> --
> Zheng Xudong
> State Key Laboratory of Software Development Environment
> School of Computer Science and Engineer, BeiHang University
>
>
>
>  --
Zheng Xudong
State Key Laboratory of Software Development Environment
School of Computer Science and Engineer, BeiHang University
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to