java - JPA EntityManager limit number of concurrent operations on DB -


I am using the JPA framework to operate some databases.

First, I save the entity object to a specific table by using an EntityManager object and then I use the code snippet

  "EntityManager .persist (specialty) "  

and this continuous action is done with the method with annotaion

 " @ transfer entry (TransactionAttributeType.REQUIRES_NEW) "< / Code>  

I try to keep a large number of data in it using the loop in that method and all data is a transaction Nothing remains in it. Generally it all works well, but when I try to continue several rows, I have to face the problem and error.

  "Operation record in the transaction coordinator Outsourcing (maxnowofconcurrent option) "  

My DB supports about 32,000 concurrent tasks. Therefore there is no way in the JPA framework to specify the maximum number of concurrent actions.

I think that you create your entities within the loop and EntityManagers is set to commit FlushModeType Which means that the EM waits for your deal, unless the database is sent to send / insert records.

Even if you believe the EM is the maximum operating number, which has incorporated thousands of entities into one transaction (worst case scenario: even waiting for the committee's flat files to report transaction data Writing too) is definitely not a great idea.

For any type of batch processing, or at least in this special case start with auto-recorded records made by FlushmodeType on auto.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -