I have an hibernate application that currently runs in a single thread. I am using a SessionFactory and doing something like:
Code:
Session session = factory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
// Do some work
session.load(...);
session.persist(...);
tx.commit(); // Flush happens automatically
}
catch (RuntimeException e) {
tx.rollback();
throw e; // or display error message
}
finally {
session.close();
}
My threading works fabulously till my code hits factory.openSession. It all gets serial after that. I have enabled thread-bound strategy as I am using JDBCTransactionFactory.
Why does my code become serial after this point?