How to update columns value with new value
hibernate
Solution
Have you tried below code? Always remeber to mention what all possible solutions you tried before asking question.
User user=session.get(User.class, 3); // 3 is ID of user.
user.setBalance((user.getBalance()+500));
session.saveOrUpdate(user);
session.commit();
Problem
I would like to update column value with a new entity value incrementally, for example: support I have a table USER with COLUMN name BALANCE for specific user, his balance is 3000. Now, I would like to set his value to 3500. I have hibernate "User" Entity that has a 'balance' value of 500. How can I make the update?? If I would like to make it using pure sql query, I would simple do: "UPDATE USER set balance = balance+500 where user_id=3" I would like to avoid calling sql and use hibernate.