Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8834417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:00:35+00:00 2026-06-14T09:00:35+00:00

Official documentation says: Batch writing can improve database performance by sending groups of INSERT,

  • 0

Official documentation says:

Batch writing can improve database performance by sending groups of
INSERT, UPDATE, and DELETE statements to the database in a single
transaction, rather than individually

(emphasis is mine).

But if an entity has Optimistic Locking @Version field, then all UPDATEs are executed independently.

To prove this, here is the source code snippet DatabaseAccessor:566:

if (/* ommited */(!dbCall.hasOptimisticLock() || getPlatform().canBatchWriteWithOptimisticLocking(dbCall) ) /* ommited */) {
  // this will handle executing batched statements, or switching mechanisms if required
  getActiveBatchWritingMechanism().appendCall(session, dbCall);
  //bug 4241441: passing 1 back to avoid optimistic lock exceptions since there   
  // is no way to know if it succeeded on the DB at this point.
  return Integer.valueOf(1);
}

So, basically, what above snippet means, is that if Entity has an optimistic lock, then batch update will be ignored.

Is there a workaround for that? I still want to use JPA.

UPDATE:
It turned out that I needed to add this property to persistence.xml in order to enable batch update with optimistic locking:

<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.oracle.Oracle11Platform"/>  

Note, that Oracle10Platform or higher could be used as a value. Lower versions don’t support this feature.

Also, to enable batch writing, you have to add at least one property in your persistence.xml:

<property name="eclipselink.jdbc.batch-writing" value="JDBC" />  

You can also, optionally configure batch size:

<property name="eclipselink.jdbc.batch-writing.size" value="1000" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:00:37+00:00Added an answer on June 14, 2026 at 9:00 am

    Did you check the canBatchWriteWithOptimisticLocking() method for the platform class you are using? This call is there so that if your driver can support returning the row counts for individual calls within the batch so that Eclipselink can throw an optimistic lock exception as required, batching can be used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Official appengine documentation says that if we set threadsafe property to true in app.yaml
The official documentation says that Your application must have a local Service to facilitate
The official documentation says they are optional. I know COM interop requires a unique
If we check the official documentation we can find various ways of interfacing Erlang
From the official documentation: A subclass of Dialog that can display one, two or
The official documentation here just says, match may be a tag name or path,
The official documentation says to modify an entity I retrieve a DbEntityEntry object and
Ok guys I'm little stacked here. According to official documentation Google says that Once
where can I find some official documentation for android theme xml definitions like android:windowBackground,
Official documentation says: Supply a tag for this view containing a String, to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.