Hibernate Collection performance problem.
I am facing significant performance problem when I add a item to the collection. As the number of items are added to the collection, the performance degrades. Take example of and Order and Order containing a set of items. In hibernate I do order.add(item) and the persist order. Each new item is added to the order in subsequent transactions, it takes more and more time. It appears the hibernate before inserting a new items, compares the new item with the existing ones and then inserts.
I compared the performance with the items written directly to the database rather than adding them to order and the performance is much better. Does any know what I could be doing wrong while adding item to the order. Please note all the new items are added to the order in seprate transactions. I am not using second level cache.