gpt4 book ai didi

java - 字符 15 处不存在 Postgres 函数

转载 作者:行者123 更新时间:2023-11-29 12:22:25 25 4
gpt4 key购买 nike

我们有一个定义如下的 postgres 函数:

Schema              | public
Name | getallocationmap_global
Result data type | refcursor
Argument data types | OUT v_set refcursor, integer, integer, bigint, integer,
smallint, character varying, bigint, bigint, bigint, bigint,
bigint, bigint, bigint, integer, bigint, double precision,
double precision, bigint, double precision, smallint, double
precision, integer, integer, integer, character varying, integer
Type | normal

我们目前通过 hibernate 的命名查询在我们的网络应用程序中使用这个函数。命名查询按以下方式定义:

<sql-query name="selectAllocationMapByNw_SP" callable="true">
<return alias="alloc" class="com.zedo.data.dto.AllocationMap">
<return-property name="id" column="id" />
<return-property name="channelCode" column="channel_code" />
<return-property name="creativeId" column="creative_id" />
<return-property name="priority" column="priority" />
<return-property name="status" column="status" />
<return-property name="impressionsAllocated"
column="impressions_allocated" />
<return-property name="impressionsDelivered"
column="impressions_delivered" />
<return-property name="clicksAllocated" column="clicks_allocated" />
<return-property name="clicksDelivered" column="clicks_delivered" />
<return-property name="actionsAllocated" column="actions_allocated" />
<return-property name="actionsDelivered" column="actions_delivered" />
<return-property name="piactionsDelivered" column="piactions_delivered" />
<return-property name="timezoneId" column="timezone_id" />
<return-property name="allocateByDay" column="allocate_by_day" />
<return-property name="ecpm" column="ecpm" />
<return-property name="earnedTotal" column="earned_total" />
<return-property name="vactionsDelivered" column="vactions_delivered" />
<return-property name="vearnedTotal" column="vearned_total" />
<return-property name="level" column="level" />
<return-property name="weight" column="weight" />
<return-property name="cap" column="cap" />
<return-property name="durationType" column="duration_type" />
<return-property name="duration" column="duration" />
<return-property name="capStatus" column="cap_status" />
<return-property name="code" column="code" />
</return>
{ ?=call getallocationmap_global(:nwId, :id, :channelCode, :creativeId,
:priority, :status, :impressionsAllocated, :impressionsDelivered,
:clicksAllocated, :clicksDelivered, :actionsAllocated, :actionsDelivered,
:piactionsDelivered, :timezoneId, :allocateByDay, :ecpm, :earnedTotal,
:vactionsDelivered, :vearnedTotal, :level, :weight, :cap, :durationType,
:duration, :capStatus, :code) }
</sql-query>

我们访问这个命名查询的方式是:

Query query = getSession().getNamedQuery("selectAllocationMapByNw_SP");  

其中 getSession() 将返回当前的 hibernate session 。

然后在我们为该查询设置可用参数并以这种方式执行它之后:

List retList = query.list();  

这种方法在大多数情况下都有效,但突然在运行的应用程序中的给定时间点开始抛出以下异常:

[org.hibernate.util.JDBCExceptionReporter 280912:063129 WARN ] - SQL Error: 0, SQLState: 25P02
[org.hibernate.util.JDBCExceptionReporter 280912:063129 ERROR] - ERROR: current transaction is aborted, commands ignored until end of transaction block
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - : org.hibernate.exception.GenericJDBCException: could not execute query
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - SQLStateConverter.java::handledNonSpecificException() - 126
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - SQLStateConverter.java::convert() - 114
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - JDBCExceptionHelper.java::convert() - 66
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - Loader.java::doList() - 2231
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - Loader.java::listIgnoreQueryCache() - 2125
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - Loader.java::list() - 2120
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - CustomLoader.java::list() - 312
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - SessionImpl.java::listCustomQuery() - 1722
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - AbstractSessionImpl.java::list() - 165
[AllocationMapSQL 280912:063129 ERROR] - AllocationMapSQL::updateWithStatus() - - SQLQueryImpl.java::list() - 175
[AllocationMapSQL 280912:063129 ERROR] - ConcreteAllocationMapHibernateDAO::executeSearch() - 111

此外,在数据库日志中我们看到以下错误:

ERROR:  function getallocationmap_global(unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist at character 15
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

我们检查了传递给该函数的所有参数和参数类型,它们确实匹配。

附言- 在我们的应用程序中, hibernate 操作是通过包含在类路径中的 jar 文件执行的。

配置如下:

操作系统 - openSUSE 10.3 (X86-64) - 内核\r (\l) hibernate 版本 - 3.3.1-GAPostgres - 9.1.4JDK-1.6.0-22。Tomcat-apache-tomcat-7.0.8。JDBC jar - postgresql-9.1-901.jdbc3.jar

请告诉我可能的原因。提前致谢。

最佳答案

我建议查看事务 block 。

ERROR: current transaction is aborted, commands ignored until end of transaction block 与一个打开的事务相关联,在该事务中发生错误,之后客户端试图打开另一个事务(例如):

BEGIN;
SELECTT 1; -- ERROR: syntax error at or near "SELECTT"
BEGIN; -- ERROR: current transaction is aborted, commands ignored until end of transaction block

关于java - 字符 15 处不存在 Postgres 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12702120/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com