Confused Developer
Confused Developer

Reputation: 65

EclipseLink 2.3 plus Oracle 11g batch-writing

I have an Oracle 11g database which I connect to it through EclipseLink 2.3. One of entities in my project should be persisted quite often (e.g., 10 times per second) which is more than other entitities. In order to increase the performace of my transactions, I added the following line to my pesistence.xml to activate batch-writing.

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

However, I think it will turn on the batch-writing for all entities. I would like to ask:

1) Besides adding above line to my persistence.xml, do I need to change anything else in my DAO files?

2) If batch-writing offers any disadvantages for other entities, how can I turn on batch-writing only for one entity in EclipseLink?

3) Shall I keep the value "JDBC" or should I switch to "Oracle-JDBC" in the property?

Upvotes: 3

Views: 591

Answers (1)

MRalwasser
MRalwasser

Reputation: 15973

  1. No, this configuration directive is everything you need to enable batch writing.

  2. No, batch writing can only be set per persistence unit.
    Theoretically you can split your persistence unit into smaller pieces and enable batch writing only for one of them. But I would not do that. I see no problems enabling batch writing.

  3. I would keep JDBC. It's the most compatible (and likely most tested) approach.
    The difference is that Oracle-JDBC uses oracle proprietary native batch writing, while JDBC relies on the JDBC standard. The performance of Oracle-JDBC might be a little bit better but is most probably not worth the disadvantages.
    However, you should measure the difference if you are concerned about insertion performance.

BTW: 10 entities per second is IMHO not really a big number. Some applications do 1000 persists (or more) per second.

Upvotes: 2

Related Questions