Hello,
Currently I am trying to insert 20,000+ records into my database via a job that will run bi-nightly. I currently have a service method which takes an array of my object, and this service method calls the DAO save method x times. I am using Hibernate for O/R. I keep running into an Out of Memory error and my entire system comes crashing down. What am I doing wrong? Should I be using a different transaction strategy?
Thanks for any help
CategoryService code
CategoryDAO codeCode:for (int i = 0; i < categories.length; i++) { categoryDAO.saveCategory(categories[i]); }
application-context.xml file:Code:getHibernateTemplate().save(category);
Code:<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"><ref local="mySessionFactory"/></property> </bean> <bean id="categoryDAO" class="com.test.dao.impl.CategoryDAOImpl"> <property name="sessionFactory"><ref local="mySessionFactory"/></property> </bean> <bean id="categoryService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="proxyInterfaces"><value>com.test.service.CategoryService</value></property> <property name="target"> <ref local="categoryServiceTarget"/> </property> <property name="transactionManager"> <ref bean="hibernateTransactionManager"/> </property> <property name="transactionAttributes"> <props> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED, readOnly</prop> </props> </property> </bean> <bean id="categoryServiceTarget" class="com.test.service.impl.CategoryServiceImpl"> <property name="categoryDAO"><ref local="categoryDAO"/></property> </bean>


Reply With Quote