Sorry, whole codes
public static final ThreadLocal session = new ThreadLocal();
Session s = (Session) session.get();
// Open a new Session, if this
Thread has none yet
if (s == null)
{
s = sessionFactory.openSession();
session.set(s);
}
MyType something =
(MyType) s.get(
MyType.class, primaryKey);
.......
if (something != null)
{
Transaction tx = session.beginTransaction();
session.delete(something);
tx.commit(); // Error
session.flush();
HibernateUtil.closeSession();