[ 
https://issues.apache.org/jira/browse/OPENJPA-2210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396754#comment-13396754
 ] 

Sathish commented on OPENJPA-2210:
----------------------------------

Thanks for lots of information Kevin. 
Actually this was a mistake from my side where in the code i used the statement

entityManager.createNativeQuery("getPaymentById")  

for the native query defined in the orm.xml above . The issue is resolved when 
i modified it to

entityManager.createNamedQuery("getPaymentById")  

THanks once again Kevin.

                
>  Method executeQuery cannot be used for update. ERRORCODE=-4476, SQLSTATE=null
> ------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2210
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2210
>             Project: OpenJPA
>          Issue Type: Question
>          Components: jdbc, jpa
>    Affects Versions: 1.0.0
>         Environment: Windows 7, 64 bit operating system , RAD - 8.0.4, WAS 
> 7.0, db2jcc4.jar, 
>            Reporter: Sathish
>            Priority: Critical
>              Labels: newbie
>
> I am using OpenJPA 1.x to persist the datas using the Application Server WAS 
> 7.0. Now I created a 'named-native-sql' to perform a join operation and its 
> corresponding sql-result set mapping in my orm.xml to get the records. THe 
> configuration is as follows
>               <named-native-query name="getPaymentById" 
> result-set-mapping="sql_result">
>                       <query>SELECT T1.*, T2.*, T3.* FROM SSP.PMNT T1 LEFT 
> JOIN SSP.PMNT_REF T2 ON T1.PYMT_ID = T2.PYMT_ID LEFT JOIN SSP.RMRK T3 ON 
> T1.PYMT_ID = T3.PYMT_ID WHERE T1.PYMT_ID = 8 
>                       </query>
>               </named-native-query>           
>               <sql-result-set-mapping name="sql_result">
>                       <entity-result entity-class="Payment"></entity-result>
>                       <entity-result 
> entity-class="PaymentReference"></entity-result>
>                       <entity-result entity-class="Remark"></entity-result>
>               </sql-result-set-mapping>
> Now when the application runs i am getting the following exception
> Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10103][10941][3.58.81] 
> Method executeQuery cannot be used for update. ERRORCODE=-4476, SQLSTATE=null
> at com.ibm.db2.jcc.am.ed.a(ed.java:660)
> at com.ibm.db2.jcc.am.ed.a(ed.java:60)
> at com.ibm.db2.jcc.am.ed.a(ed.java:120)
> at com.ibm.db2.jcc.am.tm.a(tm.java:3945)
> at com.ibm.db2.jcc.am.um.b(um.java:3455)
> at com.ibm.db2.jcc.am.vm.Zb(vm.java:144)
> at com.ibm.db2.jcc.am.vm.executeQuery(vm.java:127)
> at 
> com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java:1105)
> at 
> com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:726)
> Please let me know what could be the error and how to resolve it. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to