>That is horrible, and now I need to think :-(
>Ah - please reverse aWriter.close() and trans.commit().

Thats not going to do anything since I can see that its not in a transaction when its in the while() loop.

IE. while its processing I can open another connection to the database and see the updates its making in the while() loop. If it were in a transaction then I couldnt see the updates until the commit.

dave
ps. The "invalid state" is happening because the updates arent in a transaction. When the exception occurs there's no rollback. pps. My "equalsExact" change isnt a performance improvement -- its a bug fix. Its completely wrong the way it is. Right now you cannot flip the direction of linestrings nor can you fix invalid geometries! If you try, you'll either get no updating or exceptions.



private void process() throws Exception
   {
       DefaultTransaction trans = new DefaultTransaction();
FeatureWriter aWriter = ds.getFeatureWriter(table_name,trans);
              while (aWriter.hasNext())
       {
           Feature f = aWriter.next();  // get a feature
           Geometry g = (Geometry) f.getAttribute(source_column);
                      Geometry g_gen = generalize(g,tolerance);
           f.setAttribute(dest_colum,g_gen);  // modify it
           aWriter.write();  // write it to DB
       }
       trans.commit();
       aWriter.close();
   }





-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to