Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Copying records from between 2 databases with JPA  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

I am new to this forum. Found this forum while looking for a solution for my problem. It looks very cool!

I need your help. I am doing JPA (eclipselink) since some weeks and i am wondering if there is a way to optimize my code.
Simplified i need to copy 500-1000 records from one database to another when the user presses on a button.

I have the entities A and B where A has a list of B.

So when the user starts the copying i load all B's from A with

and then i iterate over the list and persist each B.

This takes about 2-3 seconds for 500-1000 records. (just guessed the time, did not measure it)

My question is how this can be optimized?

The first thing i have in mind is the caching.
The caching is active, but i do not need all these records to get into the cache.
Is it possible to bypass the cache for loading and persisting these records?

And if there are more ways to optimize the process i would be very happy if you can help me out!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!