Hibernate executeupdate not updating
Hibernate Query Language (HQL) is an object-oriented query language, similar to SQL, but instead of operating on tables and columns, HQL works with persistent objects and their properties.HQL queries are translated by Hibernate into conventional SQL queries, which in turns perform action on database.So for sure it will include select query and then update query.If you try to update the object by preparing it in your java world itself and not getting the fresh one from DB, then it may create certain Synchronization probs.
In the latter case, it may require too many resources to assemble an entity object just to change the value of a single field, for instance.i think, hibernate not even consider the query ,while start reading the query itself its throwing error . Hibernate will take care of updating the object for you.I did it in another way using session.get(classname.class,id); and setting the appropriate value in setter method is working fine, i am getting required result , but the pbm is seems to execute the query too many times (runing select query once and update query once ) and also not sure whether this is the feasible solution or not . and since you are updating the object in DB, you need to retrive it first and then update the object and finally flush it into DB.Following is the simple syntax of using named parameters − Bulk updates are new to HQL with Hibernate 3, and delete work differently in Hibernate 3 than they did in Hibernate 2.The Query interface now contains a method called execute Update() for executing HQL UPDATE or DELETE statements.