我正在重新开展一个我大学里有人正在研究的旧项目。它主要是一些地理数据的数据库管理(使用postgis 1.5和2.0制作,使用postgis 1.5和2.0)以及一些修改和java netbeans中的GUI。对于这两者之间的接口,正在使用Maven和hibernate。
这笔交易是,当我尝试运行应该正常工作的应用程序时,我得到了这个错误
SEVERE: ERROR: no existe la función srid(geometry)
Exception in thread "AWT-EventQueue-0" org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:174)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1163)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334)
at testdb.ui.NetworkClustering.updateOLTdistance(NetworkClustering.java:609)
at testdb.ui.MetroClustering.setMetroOltDist(MetroClustering.java:118)
at testdb.ui.MetroClustering.clusterData(MetroClustering.java:38)
at com.kipouridis.thesis.GUI.MetroDialog.jButton1ActionPerformed(MetroDialog.java:102)
at com.kipouridis.thesis.GUI.MetroDialog.access$100(MetroDialog.java:19)
at com.kipouridis.thesis.GUI.MetroDialog$2.actionPerformed(MetroDialog.java:56)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:154)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
at java.awt.Dialog.show(Dialog.java:1082)
at java.awt.Component.show(Component.java:1651)
at java.awt.Component.setVisible(Component.java:1603)
at java.awt.Window.setVisible(Window.java:1014)
at java.awt.Dialog.setVisible(Dialog.java:1005)
at com.kipouridis.thesis.GUI.ONUAdmin.calcDistQueryButtonActionPerformed(ONUAdmin.java:219)
at com.kipouridis.thesis.GUI.ONUAdmin.access$100(ONUAdmin.java:44)
at com.kipouridis.thesis.GUI.ONUAdmin$2.actionPerformed(ONUAdmin.java:94)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
到达断点时,我发现当它到达DB的一次更新时出现错误,在此行之后:
result = oltDistQ.executeUpdate();
以及在oltDistQ中应用它的查询如下:
String oltDistQuery = "update connections set oltdist = (select result.distance from "
+ "(select sum( st_length(st_transform(the_geom,2163))) as distance "
+ "from dijkstra_sp_delta('ways' , ( select onu.source from onu where onu.gid = connections.gid )"
+ " , (select rn.source from onu as rn where rn.gid = "
+ "(select olt_id from metro_nets where net_id = connections.metro_net ) ),0.01)) as result ) "
+ "where metro_net = " + 0;
我检查了数据库,所有列似乎都存在,据我所知,该查询中没有声明函数srid(几何)。我知道这个函数已更新,现在它被声明为st_srid(geometry)
,但我无法找到的是调用此函数的位置或我可以检查它的位置。
我检查了java文件,似乎在查询更新中没有使用该函数,对于DB,如果函数被调用且psql无法识别它,桌子无法创造;但它们已创建并具有所需数据。
有几个行代码(和代码文件),我不太了解,因为我说它不是我自己的项目。但我在这里失去了希望,因为我不知道在哪里检查以解决这个错误。
如果有人知道某事,那真的很有帮助。
提前致谢!
答案 0 :(得分:1)
原始功能被命名,例如srid(geometry)
,但后来用ST_
前缀(即 s patial t ype)重命名。要使用最初命名的函数,请找到名为legacy.sql
的PostGIS安装附带的启用程序脚本(legacy_minimal.sql
也可以,但我不知道)。这些将为旧数据库提供旧数据库的遗留功能。
像这样使用它们:
psql -d [yourdatabase] -v ON_ERROR_STOP=1 -f legacy.sql