I have 2 threads. Main thread that has a sessionFactory object and a separate thread that I want to execute a query.
When I write the following (in psedo code):
new Thread( () -> {
try(Session s = sessionFactory.openSession()){
s.beginTransaction()
s.createQuery(SQL COMMAND).executeUpdate();
s.getTransaction().commit();
}
}).start()
I see when adding printing that the session is the new thread is open but the executeUpdate never happens.
What is the problem?