Reputation: 19
We have a postgres function which is defined as given below:
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
We are currently using this function in our web application via hibernate's named query. The named query is defined in the following way:
<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>
The way we access this named query is:
Query query = getSession().getNamedQuery("selectAllocationMapByNw_SP");
where getSession() will return the current hibernate Session.
Then after we set the available parameters to this query and execute it in this manner:
List retList = query.list();
This approach works most of the times, but suddenly at a given point of time in an running application it starts throwing the following exception:
[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
Also, in the db logs we see the following error:
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.
We have checked all the parameters that are passed to this function and the argument types and they do match.
P.S. - In our application the hibernate operations are performed via a jar file which is included in the classpath.
Given below are the configurations:
OS - openSUSE 10.3 (X86-64) - Kernel \r (\l) Hibernate version - 3.3.1-GA Postgres - 9.1.4 JDK - 1.6.0-22. Tomcat - apache-tomcat-7.0.8. JDBC Jar - postgresql-9.1-901.jdbc3.jar
Please let me know the possible cause for the same. Thanks in advance.
Upvotes: 1
Views: 3158
Reputation: 2354
I would recommend to take a look into transaction blocks.
ERROR: current transaction is aborted, commands ignored until end of transaction block
is associated with an open transaction inside which an error occurs and when after that client is trying to open another transaction (e.g.):
BEGIN;
SELECTT 1; -- ERROR: syntax error at or near "SELECTT"
BEGIN; -- ERROR: current transaction is aborted, commands ignored until end of transaction block
Upvotes: 1