cancel
Showing results for 
Search instead for 
Did you mean: 

Named parameter substitution failure in set clause of update statement.

Former Member
0 Kudos

Hi ,

Following is a method in my session bean. Its trying to update 'Activities' entity through JPQL. I am using a named parameter 'var2' to set the value of 'actPst1Cd' field.

String stmt = "update Activities A set A.actPstlCd = :var2 where A.actRmatId = :var1";

Query query = em.createQuery(stmt);

query = query.setParameter("var1", new BigDecimal(1));

query = query.setParameter("var2", getVar2Value());

return query.executeUpdate();

On execution I am getting the following error.

java.lang.IllegalArgumentException: There is no parameter with name ':var2' in this JPQL-query. at com.sap.engine.services.orpersistence.query.QueryImpl.assertValidTypedValue(QueryImpl.java:303) at com.sap.engine.services.orpersistence.query.QueryImpl.setParameter(QueryImpl.java:369) at session.Test2Bean.testUpdate(Test2Bean.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585)

………………………………..

…………………………………

The named parameters in where clause are getting substituted successfully. Can anyone please tell me why its failing in set clause?

I am using SAP NetWeaver Application Server, Java(TM) EE 5 Edition for deployment.

Thanks,

Prasoon.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Prasoon!

I am currently trying to reconstruct your issue. I need a confirmation on the version of Netweaver AS Java you use. You mention in your post that you use the Java EE 5 Edition. In contrast you wrote another post where you stated that you use the CE 7.1 version. Determining the verison is crucial for reconstructing and finding a solution.

Thanks & Best Regards,

Robin

Former Member
0 Kudos

Hi Robin ,

Thanks for replying..

Issue I have Posted here is coming in <b>Java EE 5 Edition</b>.

Regarding another post, I wanted to try CE 7.1 version when I found that my current entities ( which works in Java EE 5 Edition ) are giving error in CE7.1 because of Bigdecimal check in Entity Validation, hence posted another post.

Thanks,

Prasoon

Former Member
0 Kudos

Hi Prasoon!

I reconstructed your issue on both Java EE 5 Edition and NW CE 7.1. On the latter it works. Please try to deploy your app to CE 7.1 and run it there.

Best Regards,

Robin