views:

45

answers:

1

Hi, I had a problem where I was using the hibernate template to do most of my DB work but I had a part of the system that directly accessed the session to do batch persisting. I noticed that the hibernate template session was old and would be storing cached values which didnt take into account the objects save with the session directly.

What are the drawbacks of using alwaysUseNewSession? This fixes the problem as I always get up-to-date objects.

Thanks.

A: 

I guess there is some performance-overhead with using this since it requires Hibernate to close old and open new sessions more frequently.

Lars Andren