The moose likes Object Relational Mapping and the fly likes Hibernate Batch with <join> Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate Batch with <join>" Watch "Hibernate Batch with <join>" New topic
Author

Hibernate Batch with <join>

Vignesh Murali Natarajan
Ranch Hand

Joined: Jul 24, 2006
Posts: 65

Hi,
I'm facing a problem with getting Hibernate to do batch inserts. I have an Entity (called 'Extract') that has a component class which is mapped to a secondary table using <join> element. It also has a <one-to-many> relationship with a different entity. When I try to do a batch insert of Extract objects, Hibernate does not seem to be batching them. So if there were 10000 Extract records to be inserted, Hibernate generates 10000 inserts and runs batch sizes of 1. I have set my batch_size to 50, enabled order_inserts & order_updates. However if I remove the <join> element from the mapping, Hibernate does the batching correctly. Please correct me if my understanding is incorrect

Here are excerpts from my src

hibernate cfg xml


The Extract hbm



The entity classes are just POJOs.

Please help!


ThanQ,
Vignesh Murali N
www.vigneshmurali.com
SCJP(95%), SCWCD(92%), SCBCD(97%), SCDJWS(97%), SCBCD5(100%), OCMJEA
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hibernate Batch with <join>
 
Similar Threads
ORA-00001: unique constraint exception
Hibernate Newbie - 1 to Many Relation Tutorial
Caught a NonUnique Exception while adding more rows to the table.
If somebody can translate this for me please?
Hibernate - multiple collection with restrictions mapping problem