Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

could not locate named parameter  RSS feed

 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys i have an issue about could not located named parameter ["SomeParameter"]

and this is what i got


and this is the line which on PendapatanController.java
line 209 is q.setParameter("namapemohon", namaPemohon); and this related to my query
and this query will invoke value from Database
and this is the query "lower(p.NamaPemohon) like lower('%:namapemohon%') "

and :namapemohon above is my Parameter, did you think guys there is something wrong in my code??
so where exactly should i fix the error??

need your help
thanks in advance
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a JSF problem, it's a Hibernate/JPA problem. So the best place to ask questions like this is in the Hibernate/JPA forum where the experts on that subject hang out.

Offhand, I think your problem is in the like lower('%:namapemohon%'). If memory serves, that value will be interpreted as a string literal value, not as a replaceable variable reference. What you need is closer to this:


The query code snippet would then be simply:
 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:This isn't a JSF problem, it's a Hibernate/JPA problem. So the best place to ask questions like this is in the Hibernate/JPA forum where the experts on that subject hang out.

Offhand, I think your problem is in the like lower('%:namapemohon%'). If memory serves, that value will be interpreted as a string literal value, not as a replaceable variable reference. What you need is closer to this:


The query code snippet would then be simply:




hi tim thnks for your reply my issue has solved
i use pattern like this
query.setParameter("namaPemohon",'%' + namaPemohon + '%');
but i got another problem so when i hit button searh and pop up panel comes up and this pop up have a content or value that i retrieve from database
here is the problem on that pop up panel i serve a "Print " button when i click on that nothings happen and in print method i do wrote System.out.println("success");
but the word is not print on the log
did you you know where is the problm??
by the way i use rich:modalPanel, rich:dataTable with "Print" Button inside
when it click nothing happen
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether you use "%" or '%' doesn't matter in this case. I prefer the String notation myself since it assures me that the '%' won't accidentally get promoted to an integer datatype.

We recommend that when you have a completely different question that you start a new topic. That way people aren't answering 2 questions at once, and people who weren't interested in the original topic but might have an interest in the new topic will see it.

One reason we recommend avoiding System.out methods in webapps is that there's no guarantee where the results will go. In fact, there's no guarantee that they won't be discarded completely. So it's much better to use a logger when you can.

A web server cannot control client-side printing in any way, for security reasons. The best that the server can do is ensure that the page layout has been set up to look good when printed. An actual "Print" button on a displayed webpage cannot use JSF - it has to call the JavaScript webpage print method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!