-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.HibernateException: Errors in named queries
PostPosted: Wed Feb 20, 2008 3:51 am 
Newbie

Joined: Wed Feb 20, 2008 3:34 am
Posts: 9
Location: Bangalore
Guys,
I am calling stored procedure from java.

Stored Procedure:
--------------------

CREATE OR REPLACE PROCEDURE test_APS_payment_report
(
o_cur_test_payment_rpt OUT sys_refcursor,
i_dt_from_date IN DATE,
i_dt_to_date IN DATE
) IS

l_cursor VARCHAR2 (4000);
l_str_where VARCHAR2 (2500);
l_str_select VARCHAR2 (2500);
l_str_from VARCHAR2 (500);
l_dt_from_date DATE;
l_dt_to_date DATE;

BEGIN

l_dt_from_date := i_dt_from_date;
l_dt_to_date := i_dt_to_date;

----------------------Select Statements----------------------------------
l_str_select := ' SELECT pmt_reference_id AS transactionid,';
l_str_select := l_str_select ||' Source_system_id as SourceSystemID,';
l_str_select := l_str_select ||' depacctfrom_account_id AS debitaccount,';
l_str_select := l_str_select ||' depacctfrom_branch_id AS OrderingInstitutionBIC,';
l_str_select := l_str_select ||' depacctidto_account_id AS creditaccount,';
l_str_select := l_str_select ||' payee_branch_id AS AccountInstitutionBIC,';
l_str_select := l_str_select ||' pmtaddrq_currency_cd AS currency,prcdate_tm AS valuedate,';
l_str_select := l_str_select ||' pmtstatus_effective_date_tm AS executiondate,';
l_str_select := l_str_select ||' pmtstatus_payment_status_cd AS PostingStatus';

----------------------From Statement----------------------------------
l_str_from := ' FROM ctsi_req_res_table';

----------------------Where Statements----------------------------------

/* If both the dates are NOT NULL then this is executed */
l_str_where := ' WHERE (TO_DATE(invoice_effective_date_tm,'||chr(39);
l_str_where := l_str_where || 'DD/MM/YYYY'||chr(39)||')';
l_str_where := l_str_where || ' BETWEEN TO_DATE('||chr(39)||l_dt_from_date||chr(39);
l_str_where := l_str_where || ',' ||chr(39)||'DD/MM/YYYY'||chr(39)||')';
l_str_where := l_str_where || ' AND TO_DATE('||chr(39)||l_dt_to_date||chr(39);
l_str_where := l_str_where || ',' ||chr(39)||'DD/MM/YYYY'||chr(39)||'))';

----------------Cursor Statement----------------------
l_cursor := l_str_select ||l_str_from||l_str_where;

p_clu_log(51,'test_APS_payment_report',l_cursor);

OPEN o_cur_test_payment_rpt FOR l_cursor;

-----------------When Exception Occurs------------------------
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SQLERRM);

/* END of PROCEDURE */
END test_APS_payment_report;
/


Mapping File:
---------------

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<sql-query name="APSForPaymentMode" callable="true">
<return class="com.citi.aps.daovo.APSReportVO">
<return-property name="SourceSystemID" column="Source_system_id"/>
<return-property name="debitaccount" column="depacctfrom_account_id"/>
<return-property name="OrderingInstitutionBIC" column="depacctfrom_branch_id"/>
<return-property name="creditaccount" column="depacctidto_account_id"/>
<return-property name="AccountInstitutionBIC" column="payee_branch_id"/>
<return-property name="pmtaddrq_currency_cd" column="currency"/>
<return-property name="pmtstatus_effective_date_tm" column="executiondate"/>
<return-property name="pmtstatus_payment_status_cd" column="PostingStatus"/>
</return>
{ ? = call test_APS_payment_report(?, ?)}
</sql-query>
</hibernate-mapping>


Java Code:
-------------

Session session = currentSession();
Query query = session.getNamedQuery("APSForPaymentMode");
query.setString(0, apsReportVO.getFromDate());
query.setString(1, apsReportVO.getToDate());

I am passing the date values through apsReportVO object.
Pls tell me the reason why I am getting this exception.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.