Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 million records from oracle database

 
prince davies
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Question 1:
How do I fetch 2 million records from database ?


Question 2 :

How do I remove duplicate values in one of the fields? Can I use hashset?
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose it depends on how much memory you have, and how big the rows are.
You could just query them as normal, assuming you have enough memory, but it would probably be better to page them, or use a cursor to stream them.
Using a Set for 2 million objects might not be the best idea, you may want to use a distinct or group by on the database instead.
Depending on what you are doing with the objects, you may also consider using a JPQL Update query instead.

See,
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Pagination
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic