Hi,
I currently have to insert 300 000 users from an xml file on a database. I read my xml file with SAX and insert 3 differents objects in my oracle database for each users. But, i'm facing something strange. Every n inserts there is a sleep for 20 / 30 seconds. i can't find why.
Here is my parameter for the hiberante.cfg.xml : <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XXXX</property> <property name="hibernate.connection.username">XXXX</property> <property name="hibernate.connection.password">XXXX</property> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> <property name="default_schema">XXXX</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property> <property name="hibernate.show_sql">false</property> <property name="hibernate.connection.autocommit">false</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="c3p0.minPoolSize">2</property> <property name="c3p0.maxPoolSize">50</property> <property name="c3p0.timeout">300</property> <property name="c3p0.max_statement">5</property> <property name="c3p0.idle_test_period">150</property> <property name="c3p0.max_size">100</property>
<mapping resource="xxx/xxx/xxx.hbm.xml" /> ....
For each create i have this code : Session oSession = null; Transaction tx = null; try { oSession = HibernateUtil.getSessionFactory().openSession() ; tx = oSession.beginTransaction(); oSession.save(object); oSession.flush() ; oSession.clear() ; tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } Throws ex ; } finally { if (oSession != null) { oSession.flush(); oSession.close(); } }
Thanks in advance for your help. Regards,
HadanMarv
|