I have two database on two different machines. Let say DB1 and DB2
DB1 - JDBC connection - Select Query
DB2 - Through Hibernate - Insert Query
In DB1, there is one table user in which 35K records are present. I need to fetch this data from Java JDBC and store the data in the hibernate entity object.
Now My question is : Should I fetch the 35K records in 1 go like ( Select * from User ) and create 35 K entity obj and store one by one in DB2. In this case...my concern point is memory and how to handle if exception occur like db connection failed with DB2.
What I feel is if there is any approach in which I select 200 records and store that 200 records and so on.
Plz suggest.