I just want to put up some information on a problem that had us by the ears for a bit so that others might not have to work through it as well. The context is a multithreaded Java SE app using spring and hibernate running against an Oracle 9i and 10g DB. To make a long story short, the app reads data from the 9i DB and writes large quantities of data to the 10g DB. One idiosyncrasy that hasn't been explained is that we had been seeing very bad performance using the native generator class writing to the 10g DB and noticed that if we used increment that the speed was about 10 times faster. When we got to running larger data sets though the app we started seeing lots of StaleStateExceptions. After much investigation we decided to try using the native generator class with a sequence specified via a property and did away with the SSE. It appears that increment isn't thread safe, as this took us a while to figure out I thought I'd throw this up here as when I'd been searching for clues earlier I hadn't seen anything like our situation and so would like to save others from the headaches we suffered. As an added bonus, when we started using the sequence again the performance problem was gone and it ran a bit faster than the increment setting, which is what I had expected in the first place. Perhaps something in the DB config had changed, we don't know but there definitely seems to be a problem with multithreading and using increment even though it was all in one app and process. Cheers...
-=j=-
Hibernate version: 3.2.5
Mapping documents: N/A
Code between sessionFactory.openSession() and session.close(): N/A
Full stack trace of any exception that occurs: N/A
Name and version of the database you are using: Oracle 10G
The generated SQL (show_sql=true): N/A
Debug level Hibernate log excerpt: N/A
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html