Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate EntityManager Batch insert and update

 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rukia rukita,
Your post was moved to a new topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic