Back Forum Reply New

Collection saving, deleting, performance-wise

Hi,
I haven't had the time to seach forum for this so pardon me if it's already posted. I'd like to know if is there any difference in performance between saving/deleting objects one by one and saving/deleting them as a collection using HibernateTempate.saveOrUpdateAll(Collection coll) and what kind of difference are we talking about.

These methods have been created for convenience not performance. You would gain some performance in case of large collections since it would be only one call and the exposeNativeFlag is set to true, so the HB session used is not proxied.
If you would delete every item individually on each delete, the session would be proxied then the performance would suffer.
For bulk operations, take a look HB documentation - this way you can achieve the best performance.
¥
Back Forum Reply New