1 Reply Latest reply on Apr 26, 2007 5:26 PM by Pete Muir

    Transaction Timeout / Batch Insert

    Toni Beckman Novice


      my webapplication provides a way to import data from a CSV file. If there are too many records so, then the following exception is thrown:

      org.hibernate.exception.GenericJDBCException: Cannot open connection
      Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImpl:XidImpl

      Because I only get this exception, when there are lots of records to import into the application, I assume that at one point the transaction times out and becomes invalid. The batch insert simply takes to long.

      Where can I change/increase the timeout for a batch insert?

      Even nicer would be to have a transaction for each record to insert, because the actualy form one unit of work. So having the batch insert within one transaction is actually wrong.

      But I'm not sure, how I would do this? Should I use the @Transactional annotation? And which attribute would I have to set on which function?

      Any help is being appreciated...