i don't think that's it.
i've got a unit test testing a simple method which is basically just loading a User object, and checking the size of the groups set.
the setUp() contains
Session s = sf.openSession();
TransactionSynchronizationManager
.bindResource(sf, new SessionHolder(s));
the tearDown() contains
SessionHolder holder = (SessionHolder)
TransactionSynchronizationManager.getResource(sf);
Session s = holder.getSession();
s.flush();
TransactionSynchronizationManager.unbindResource(sf);
SessionFactoryUtils.releaseSession(s, sf);
i'm also using spring.
Marc
|