• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [1]

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using Named Query in my Project Like this
Query query = session.getNamedQuery("selectedPortfolioInfo");
query.setInteger(0, portfolioId);
query.setInteger(0, userID);
List getData = query.list();

and *.hbm.xml file entry is like this
<query name="selectedPortfolioInfo">from PfPortfolioInfo Where id.pfpiId=? And id.umulUserId=? </query>

But i am getting Exception
org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [1]

Both id.pfpiId And id.umulUserId both are composite key columns in database table

Thanks For help
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check the positions of the parameters you are passing;

query.setInteger(0, portfolioId);
query.setInteger(0, userID); query.setInteger(1, userID);

 
subodh joshi
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i was wrong and wasted the group members time in the simple issue..


thanks again
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic