Hello,
I need import many thousands records from one (non JBOSS) database into our entities. I made session bean method importData() with loop (one big transaction).
After five minutes I get warning "Transaction timed out".
Example:
@PersistenceContext(unitName="manager") EntityManager manager; @PersistenceUnit(unitName="manager") EntityManagerFactory factory; @TransactionAttribute(TransactionAttributeType.REQUIRED) public void importData() { while ( all rows from other database) { Company c = new Company(); c.setName( name ); manager.persist( c); } }
@TransactionAttribute(TransactionAttributeType.REQUIRED) public void insert(Company o) { if (o!=null) { manager.persist( o ); } }
By default transaction timeout set to 5 minutes (300 sec).
It can be changed in JBOSS_HOME/../deploy/jta-service.xml file. Look for 300 line and change value 300 to value which is appropriate for you.