慕尼黑5688855
2023-07-19 10:46:25
我有 Postgres,它可以單獨工作,但在集成到 java 并在 idempiere 上調用時不起作用。我正在尋找建議。我收到 ff 錯誤:caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "00" Position: 1055; State=42601; ErrorCode=0 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143) at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:120) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:384) at jdk.internal.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.compiere.db.StatementProxy.invoke(StatementProxy.java:130) at com.sun.proxy.$Proxy11.executeUpdate(Unknown Source) at org.compiere.util.DB.executeUpdate(DB.java:1039) at org.compiere.util.DB.executeUpdate(DB.java:898) at org.compiere.util.DB.executeUpdate(DB.java:885)
1 回答

開滿天機
TA貢獻1786條經驗 獲得超13個贊
我嘗試集成您的類示例以在 iDempiere 中進行測試,但正如 GhostCat 指出的那樣,如果您創建一個最小的可重現示例會更好,而且也非常重要,請同時發布系統在 UI 和/或中拋出的錯誤在控制臺日志中。
該類沒有一些導入,所有變量都沒有使用,并且私有方法 createDetailLines 從未被調用,我假設您提到的錯誤是在該方法中,但沒有辦法知道是否沒有被調用。
現在,查看 SQL,有兩件事需要注意:
1 - 它不是針對java格式化的,您使用“AND c.C_AcctSchema_ID= $P{C_AcctSchema_ID}”,這不是java管理變量的方式,這聽起來像jasper報告語法而不是java。對于 JDBC,您必須使用 ? 作為綁定變量的替代
2 - iDempiere是多數據庫的,系統設計的方式是編寫oracle兼容的SQL語法,并且有一個翻譯層將oracle語句轉換為postgresql語法。因此,最好避免使用 postgresql 特定語法,如“::date”或間隔“3 個月”——它可以工作,但也可能在轉換層方面出現問題。如果你想使用特定的 postgresql 語法并避免轉換層被混淆,你可以用 NATIVE_PostgreSQL_KEYWORK 包圍 postgresql 特定語法 - 請不要因為這個常量中的錯誤而責怪我:-)
添加回答
舉報
0/150
提交
取消