-->
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.  [ 2 posts ] 
Author Message
 Post subject: parameter binding order sql-query
PostPosted: Tue Aug 05, 2008 2:34 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
<bag name="tpaGenericFinancialHs" lazy="true">
<key>
<column name="SOURCE_CLAIM_NO"/>
<column name="PROCESS_RUN_ID"/>
</key>
<one-to-many
class="com.xxx.bossphase2.Financials" />
<loader query-ref="financial_sql_loader"/>
</bag>




<sql-query name="financial_sql_loader">
SELECT

fin.source_claim_no,
fin.process_run_id,
fin.claimant_no,
'ICP' AS transaction_type_cd, 'Claim_Payment' AS node_name,
SUM (fin.indemnity_paid_to_date) AS transaction_amt,
TO_CHAR (pro.as_of_finish_ts, 'YYYY-MM-DD') AS transaction_dt,
claim.data_source_cd
|| TO_CHAR (pro.execution_start_ts, 'YYYYMMDD') AS payee_nm,
SUM (fin.indemnity_paid_to_date) AS requested_payment_amt,
1 AS payment_type_cd,
TO_CHAR (pro.as_of_finish_ts, 'YYYY-MM-DD') AS check_dt,
SUM (fin.indemnity_paid_to_date) AS functional_currency_check_amt,
'USD' AS functional_currency_cd,
SUM (fin.indemnity_paid_to_date) AS payment_currency_check_amt,
'USD' AS payment_currency_cd
FROM tpa_wins_input_claim_h claim JOIN tpa_generic_financial_h fin
ON fin.source_claim_no = claim.source_claim_no
AND fin.process_run_id = claim.process_run_id
JOIN dta_process_run pro ON pro.process_run_id =
fin.process_run_id
WHERE fin.indemnity_paid_to_date > 0
and fin.process_run_id = ?
and fin.source_claim_no = ?
GROUP BY fin.source_claim_no,
fin.process_run_id,
fin.claimant_no,
claim.data_source_cd,
pro.as_of_finish_ts,
pro.execution_start_ts
<load-collection alias="Financials" role="com.xxx.bossphase2.TpaWinsInputClaimantH.tpaGenericFinancialHs" />
</sql-query>


yields the following exception:

[2008-08-05 14:29:55,916]DEBUG 609[main] - org.hibernate.type.NullableType.nullSafeSet(NullableType.java:133) - binding 'GAB2260968037' to parameter: 1
[2008-08-05 14:29:55,916]DEBUG 609[main] - org.hibernate.type.NullableType.nullSafeSet(NullableType.java:133) - binding '20748' to parameter: 2
[2008-08-05 14:29:55,947]ERROR 640[main] - org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78) - ORA-01722: invalid number


%%%% Error Creating SessionFactory %%%%
org.hibernate.exception.SQLGrammarException: could not execute query


The order of the parameters 1 and 2 need to be switched. How do you switch the ordering of the bind parameters?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 3:19 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
The answer to the ordering is here:

<class name="com.xxx.bossphase2.TpaWinsInputClaimantH" table="TPA_WINS_INPUT_CLAIMANT_H">
<composite-id>

<!-- SWAP THE ORDER OF THE KEY'S HERE AND CHANGE THE PARAMETER BINDING ORDER -->
<key-property name="processRunId" column="PROCESS_RUN_ID"></key-property>
<key-property name="sourceClaimNo" column="SOURCE_CLAIM_NO" length="30"></key-property>

<!-- SWAP THE ORDER OF THE KEY'S HERE AND CHANGE THE PARAMETER BINDING ORDER -->

</composite-id>

<bag name="tpaGenericFinancialHs" lazy="true" inverse="true" >
<key>
<column name="dataSourceCd"></column>
<column name="claimantNo"></column>
</key>

<one-to-many
class="com.archinsurance.bossphase2.Financials" />
<loader query-ref="financial_sql_loader"/>
</bag>


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

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.