views:

47

answers:

1

I am new to Hibernate. Please tell me what is the use of getHibernateTemplate().flush() and how it works.

A: 

When using Hibernate, entities are loaded into a persistence context called the session and changes like creating, updating, deleting persistent objects are actually made in memory. When you want or need to synchronize the in memory state with the database to make changes persistent, you need to flush the session, causing Hibernate to generate the appropriate SQL insert, update, delete statements.

Pascal Thivent
thnk u very much Pascal