I am using hibernate as ORM tool, i want to perform some common stuff for all the entities that i flush into the database.
Currently , whenever i save object into database, i perforrm following steps :-
- Open session
- Begin a Transaction
- Create Te Object
- save the object using
session.save(object);
- commit the transaction if save is successfull. otherwise rollback transasction.
- close the session.
Now, i want to perform some post-save and pre-flush ch开发者_StackOverflow中文版ecks, is there any way to do so.
Thanks.
You can implement 'preFlush' method of Interceptor. Check this for hibernate interceptor.
精彩评论