Dear all,
I'm trying to load a simple postgres table by code, but I have one problem with
a editing session.. (the table has a primary key)
this is the code:
Connection conn2 =
DriverManager.getConnection("jdbc:postgresql://localhost:5432/sidgrid","postgres","postgres");
String name = "lpf";
String driverInfo="postgresql";
LayerFactory.getDataSourceFactory ().addDBDataSourceBySQL(name, conn2, "select
* from lpf", driverInfo);
DataSource dataSource = LayerFactory.getDataSourceFactory
().createRandomDataSource(name,DataSourceFactory.AUTOMATIC_OPENING);
SelectableDataSource sds = new SelectableDataSource(dataSource);
EditableAdapter edit = new EditableAdapter();
edit(sds);
ProjectTable projectTable = ProjectFactory.createTable(name,edit);
ProjectExtension ext = (ProjectExtension)
PluginServices.getExtension(ProjectExtension.class );
ext.getProject().addDocument(projectTable);
and this is the error log:
Intento escribir el registro 0 de la capa
null No Primary Keys
DEBUG [AWT-EventQueue-1] (NotificationManager.java:104) - No se pudo guardar la
edici?n
java.lang.IllegalStateException: Can't overwrite cause
at java.lang.Throwable.initCause(Throwable.java:320)
at
com.iver.cit.gvsig.exceptions.visitors.ProcessWriterVisitorException.<init>(ProcessWriterVisitorException.java:11)
at
com.iver.cit.gvsig.fmap.edition.writers.JdbcWriter.process(JdbcWriter.java:106)
at
com.iver.cit.gvsig.fmap.edition.EditableAdapter.saveEdits(EditableAdapter.java:365)
at
com.iver.cit.gvsig.fmap.edition.EditableAdapter.stopEdition(EditableAdapter.java:272)
at
com.iver.cit.gvsig.project.documents.table.gui.Table.stopEditing(Table.java:730)
at
com.iver.cit.gvsig.TableEditStopExtension.stopEditing(TableEditStopExtension.java:71)
at
com.iver.cit.gvsig.TableEditStopExtension.execute(TableEditStopExtension.java:49)
...
Some ideas about this problem?
thanks,
Claudio
-------------------------
Claudio Schifani
Phd in Pianificazione Urbana e Territoriale
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" (ISTI-CNR)
Area della Ricerca CNR di Pisa
_______________________________________________
Gvsig_internacional mailing list
[email protected]
http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional