with your code, your changes will simply not be persisted
this code
Code:
ThreadLocal session = new ThreadLocal90
SessionFactory sf = (SessionFactory) new InitialContext().lookup("SessionFactory");
Session s = sf.openSession();
session.set(s);
does not need transaction because it's only an "initialisation"
now, the second part of code should be
Code:
Session session = getSession(); //that is some custom DAO method to retrieve threadLocal session --> session.get() + reconnect if necessary
Transaction tx = session.beginTransaction();
Test myclass = new Test();
mclass.setDescription("foobar");
session.save(myclass);
tx.commit();
session.close(); // this can be done in the filter depending how you want to control connexion pooling