Chas douglass <[EMAIL PROTECTED]> writes: > I'm using Derby embedded 10.1.1.0 with Hibernate 3.0.5. I have one thread > running, iterating through a number of transactions. A second thread starts > up, > performs 0 or more transactions, and then ends. At this point, thread 1 gets: > > 06:34:05,431 WARN JDBCExceptionReporter:71 - SQL Error: 20000, SQLState: > 25000 > 06:34:05,431 ERROR JDBCExceptionReporter:72 - Invalid transaction state. > org.hibernate.exception.GenericJDBCException: Cannot close connection > > I get no errors unless the two threads overlap. > > Can anyone provide any insight into what this error is trying to tell me? Or, > perhaps, suggest what further information would be necessary?
Do you by any chance, try to close a connection while you have an open transaction? Have you tried inserting a c.rollback() or c.commit() before closing the connction? Are the two threads sharing the same connection? If they do, I think you need block access from other threads to the connection object while you have an open transaction. If you can, you should really try to give each thread their own connection. That will make things much simpler. I don't know how much of this is actually under your control when using Hibernate, though... HTH -- dt
