Java Postgres函数在字符15处不存在

Java Postgres函数在字符15处不存在,java,hibernate,postgresql,Java,Hibernate,Postgresql,我们有一个postgres函数,定义如下: Schema | public Name | getallocationmap_global Result data type | refcursor Argument data types | OUT v_set refcursor, integer, integer, bigint, integer, smallint, character

我们有一个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的命名查询在web应用程序中使用此函数。命名查询的定义方式如下:

<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>  
其中getSession()将返回当前的hibernate会话

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

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
此外,在db日志中,我们看到以下错误:

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文件执行的

以下是配置:

OS-openSUSE 10.3(X86-64)-内核\r(\l) Hibernate版本-3.3.1-GA 博士后-9.1.4 JDK-1.6.0-22。 Tomcat-apache-Tomcat-7.0.8。 jdbcjar-postgresql-9.1-901.jdbc3.Jar


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

我建议您查看事务块

错误:当前事务被中止,忽略命令,直到事务块的末尾
与发生错误的已打开事务关联,并且之后客户端尝试打开另一个事务(例如):


我不知道hibernate,但我知道postgres。你说你检查了所有的参数类型,并且它们匹配,但是它们显然不匹配。您能告诉我们设置“此查询的所有可用参数”的代码吗?这可能就是问题的核心所在。Predi-参数的设置是通过以下方式使用Hibernate的ClassMetaData实例完成的:ClassMetaData meta=getSession().getSessionFactory().getClassMetadata(getPersistentClass());
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.  
BEGIN;
SELECTT 1;  -- ERROR:  syntax error at or near "SELECTT"
BEGIN;      -- ERROR: current transaction is aborted, commands ignored until end of transaction block