Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Object Relational Mapping
Hibernate: Bulk insert using native query
Michael Matthee
Greenhorn
Posts: 3
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all
I need to do a bulk insert of raw table data.
I need to use a Hibernate native query to insert the data.
I know how to do it using objects, but how can I do it using a native query ?
Session session = sessionFactory.openSession(); Transaction transaction = session.beginTransaction(); for (int i =0;i<100;i++) { EmployeeInfo employeeInfo = new EmployeeInfo(); employeeInfo.setSno(1);; employeeInfo.setName("Value : "+String.valueOf(i)); session.save(employeeInfo); if (i%50 == 0) { session.flush(); session.clear(); } } transaction.commit();
Thanks!
http://flexingcode.blogspot.com/
It's just a flesh wound! Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Regarding Hibernate Transactions
Caught a NonUnique Exception while adding more rows to the table.
Connection pool issue
jasper reports with subreports
error in running HQL Query
More...