By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,650 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,650 IT Pros & Developers. It's quick & easy.

how to update the value of particular cell in table using HQL

P: 11
Expand|Select|Wrap|Line Numbers
  1. public void saveSinglePercentage(String singlePassPercentage,
  2.             String userName) throws ApplicationException {
  4.         int singlePercent = Integer.valueOf(singlePassPercentage);
  5.           String[] params = { PASS_SPERCENT,USER_ID_PARAM };
  6.          Object[] values = {singlePassPercentage};
  7.          System.out.println(singlePercent);
  8.          System.out.println(userName);
  9.          getHibernateTemplate().update("update TUserModule tuserMod  set tuserMod.passPercentage=:singlePercent where TUser.userName=:userName"); 
when i use this i have got this error "org.springframework.orm.hibernate3.HibernateSyste mException: Unknown entity: java.lang.String; nested exception is org.hibernate.MappingException: Unknown entity: java.lang.String " please help me, Thanks in advance.
Oct 9 '13 #1
Share this Question
Share on Google+
6 Replies

P: 13,264
What is TUser in your query?
Did you mean to write
Expand|Select|Wrap|Line Numbers
  1.  update TUserModule tuserMod  set tuserMod.passPercentage=:singlePercent where tuserMod.tUser.userName=:userName"
Oct 11 '13 #2

P: 11
The UserId is present in Tuser class which have reference in tusermodule class
Oct 15 '13 #3

P: 13,264
You can't just start accessing it in the query without using the alias that you have created.
Oct 15 '13 #4

P: 11
not only that any small query is not executed in that update method.can u please suggest me to use which method from hibernate template class?
Oct 15 '13 #5

P: 13,264
You should see the API specs for that class before using it. You are using a method that expects an entity and you are passing it a query instead. If you want to use that method then you should edit the values on your entity class and pass that entity to the method instead.
Oct 15 '13 #6

P: 11
thanks so much !! I have used bulk update instead of update which take string and its working fine :)
Oct 15 '13 #7

Post your reply

Sign in to post your reply or Sign up for a free account.