Hibernate version: 3.0
I couldn't find this in any docs or on google - what's the 100% proper way to close sessions? Normally, my code looks like:
Code:
AccountPrivilege ap = new AccountPrivilege();
ap.setName(name);
ap.setDescription(desc);
Session session = SessionFactory.currentSession();
Transaction tx = session.beginTransaction();
session.save(ap);
tx.commit();
SessionFactory.closeSession();
Is this good enough? Do I need to add any "on-server-shutdown" code?
The reason I ask is because when I run a page with this, I notice a SIGNIFICANT "lag" - aka my page takes almost .5 seconds to load (whereas without that code, it's instant).
A quick question: Is there any good examples of using "map" collection mapping? The stuff in the "docs" is impossible for new users to read, any help there?
THANKS!