HQL Update Statement to update database table

Update query in HQL is used to update rows in the given database tables. This article illustrates how to used the UPDATE statement in Hibernate.

Update query in HQL is used to update rows in the given database tables. This article illustrates how to used the UPDATE statement in Hibernate.

HQL Update Statement to update database table

HQL's update query statement is used to update the values of database rows.
Though HQL is similar to SQL but instead of running on tables it directly works
with Hiberante persistent objects and their properties. Hibernate query language
(HQL) also supports WHERE, SELECT, INNER JOIN, GROUP BY Statements except
UPDATE, INSERT and DELETE Statements to perform various useful operations on
database tables.

In this article we are testing an example to update the values of database
table. See the example below...

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select insurance0_.ID as ID0_0_, insurance0_.insurance_name as insurance2_0_0_, insurance0_.invested_amount as invested3_0_0_, insurance0_.investement_date as investem4_0_0_ from insurance insurance0_ where insurance0_.ID=?
Hibernate: update insurance set insurance_name=?, invested_amount=?, investement_date=? where ID=?
Update successfully!