Hello experts,
how can I set a time-out for persisting an object ?
In my example object "reqInvoice" shall be persisted into database. If table is locked in DB insert/update will wait until table is unlocked. Unfortunately I don't want to wait years. How can I set a time-out ?
Code:
SessionFactoryManager.init(JNDI_URL);
SessionFactory sf = SessionFactoryManager.getInstance(JNDI_URL);
Session session = sf.openSession();
session.clear();
session.setFlushMode(FlushMode.COMMIT);
Transaction transaction = transaction = session.getTransaction();
transaction = session.beginTransaction();
...
Invoice reqInvoice = ...;
...
session.save(reqInvoice);
transaction.commit();
...
session.close();
Br,
Dennis