Hi Deepika
The
<sql-update> element (along with the insert and delete) are for when you want your class-entity mapping to have DML that
you define rather than Hibernate. So you will see these elements within a class mapping as per the code snippet at the top of this
serverside.com article.
Reading between the lines, I'm not sure that this is what you are after. It sounds as if you just want to issue an update statement for a non-managed entity in which case you're probably better off having the UPDATE statement in a stored procedure and calling that. There's documentation on the
Hibernate site about how to call stored procedures.
If however, you are issuing updates for a managed entity (i.e. one that you map via a
<class> definition) then you will need to be careful as it's Hibernate's Sessions that need to be looking after the entity really. In this case, the best option is to use the custom update element within the class's mapping. The Hibernate link above goes on to describe how to do this.