Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.IllegalArgumentException: Parameter UserName does not exist

801863Jan 12 2012 — edited Jan 12 2012
Hi everybody,
I connect and run queries against Oracle DB using Hibernate. I have the following piece of code:
String query = "SELECT Id, Date FROM tableName WHERE UserName=:username AND UserId=:userId";
																		  
List<Object[]> result = sessionFactory.getCurrentSession().createSQLQuery(query).setString("UserName", username).setInteger("UserId", userId).list();
I receive the following error:
java.lang.IllegalArgumentException: Parameter UserName does not exist as a named parameter in [SELECT Id, Date FROM tableName WHERE UserName=:username AND UserId=:userId]
Does anybody know what am I doing wrong? Any help is greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 9 2012
Added on Jan 12 2012
2 comments
2,248 views