Optimizing data inserts for HibernateTemplate

I have to optimize the database (especially insert) performance of a certain legacy tool. The tool has been written in Java and for the data access layer Spring + HibernateTemplate was the technology of choice.

The actual problem is doing some bulk inserts. We have to insert more than 50K data by calling HibernateTemplate.save() for each. This is apparently a very inefficient way but because of the lack of time, we cannot change the implementation for now.

What would be the optimization patterns other than changing the implementation?


The only things I can think of, if you want to optimize code without modifying the code are :

If you're ready to slightly change the code, then follow the advices of the documentation, and regularly flush and clear the session while inserting your data. Or use a stateless session.

Need Your Help

Exporting jar and importing to a project in eclipse results NoClassDefFoundError exception

java eclipse import jar export

Had a 3rd parties working JAR file in my own project, but I ran into a problem: i needed some customization to do.

Facebook-style multiple image upload

php jquery image facebook file-upload

I am searching for multiple image upload just like facebook and found the below answers on internet . ( I see even this feature with some forums software too)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.