aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate EntityManager Batch insert and update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate EntityManager Batch insert and update" Watch "Hibernate EntityManager Batch insert and update" New topic
Author

Hibernate EntityManager Batch insert and update

leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
how could i speed up when trying to insert thousands row,, i'm using jboss 5, hibernate, entity manager, oracle. i have no idea why when i'm inserting 100.000 rows it takes almost 30 minutes and finally i got an error, for your information i already added
in my persistence.xml, is there anything else i should add?

please be gentle to me because i'm new to this


thanks in advance
Sudhir Ravindra
Greenhorn

Joined: May 31, 2010
Posts: 16
Please provide a code snippet of your DAO/Class where you use the entity manager. And some more information on what error you are getting for 10000 rows of insert.
leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
Sudhir Ravindra wrote:Please provide a code snippet of your DAO/Class where you use the entity manager. And some more information on what error you are getting for 10000 rows of insert.


hi sudhir thanks for reply..
this is my class


and i used
The EntityManager on my Bean
here it is the code


and the error i got is


thanks in advance




Sudhir Ravindra
Greenhorn

Joined: May 31, 2010
Posts: 16
This is an issue with your datasource setup. Your entity manager must be consuming a data source, please explain how this is setup. Please provide snippets of your config xmls.
leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
Sudhir Ravindra wrote:This is an issue with your datasource setup. Your entity manager must be consuming a data source, please explain how this is setup. Please provide snippets of your config xmls.



this is my persistence.xml


and the oracle-ds


thanks sudhir
Sudhir Ravindra
Greenhorn

Joined: May 31, 2010
Posts: 16
you ds appears fine.
Looking at your stack trace. what exactly is the statement on at ??
Do you have hibernate showsql set to on, is it firing any statements at all to the database?
leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
Sudhir Ravindra wrote:you ds appears fine.
Looking at your stack trace. what exactly is the statement on at ??
Do you have hibernate showsql set to on, is it firing any statements at all to the database?



hi Sudhir Thank you for spend your time to reply my message, anyway in my code line 520 is persisting object, and i dont have hibernate showsql to set on,

and the question is how could i applying or perform hibernate batch insert, because i've been searching on the google but all of the tutorial said just add the


but i don't even see this is as solution for me because when i processed the transaction it's still slow

is it any the different using Session and EntityManager?

help me out Please somebody who knows the answer, because i stuck here..


thanks in advance
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3837

rukia rukita,
Your post was moved to a new topic.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate EntityManager Batch insert and update