OPENJPA-464 commiting patch provided by Teresa Kan

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@619664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2008-02-07 22:11:21 +00:00
parent 0033a6b3d9
commit 81cb7e17f9
3 changed files with 59 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import javax.sql.DataSource;
import org.apache.commons.lang.StringUtils;
import org.apache.openjpa.conf.OpenJPAConfigurationImpl;
import org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager;
import org.apache.openjpa.jdbc.kernel.BatchingOperationOrderUpdateManager;
import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
import org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory;
import org.apache.openjpa.jdbc.kernel.LRSSizes;
@ -222,6 +223,8 @@ public class JDBCConfigurationImpl
"org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager",
"batching-constraint",
BatchingConstraintUpdateManager.class.getName(),
"batching-order",
BatchingOperationOrderUpdateManager.class.getName(),
};
updateManagerPlugin.setAliases(aliases);
updateManagerPlugin.setDefault(aliases[0]);

View File

@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.jdbc.kernel;
import java.sql.Connection;
/**
* <P>Batch update manager that writes the SQL in object-level operation order.
* This update manager initiates a BatchPreparedStatementManagerImpl which
* will utilize the JDBC addBatch() and executeBatch() APIs to batch the
* statements for performance improvement.</P>
* <P>This is the plug-in class for UpdateManager to support statement
* batching for ordering. You can plug-in this statement batch implementation
* through the following property:
* <PRE>
* < property name="openjpa.jdbc.UpdateManager"
* value="org.apache.openjpa.jdbc.kernel.BatchingOperationOrderUpdateManager"
* />
* </PRE></P>
* @author Teresa Kan
*/
public class BatchingOperationOrderUpdateManager extends
OperationOrderUpdateManager {
protected PreparedStatementManager newPreparedStatementManager(
JDBCStore store, Connection conn) {
int batchLimit = dict.getBatchLimit();
return new BatchingPreparedStatementManagerImpl(
store, conn, batchLimit);
}
}

View File

@ -2683,7 +2683,7 @@ prevented; phantom reads can occur.
<literal>serializable</literal>: Dirty reads, non-repeatable reads, and phantom
reads are prevented.
</para>
</listitem>
</listitem>openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
</itemizedlist>
<example id="ref_guide_dbsetup_isoex">
<title>
@ -3149,9 +3149,14 @@ Or
</example>
<par>
By default, org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager
is the default statement batching implementation. You can plug-in your own
is the default statement batching implementation. OPENJPA also
provides another update manager
org.apache.openjpa.jdbc.kernel.BatchingOperationOrderUpdateManager for the
statements that required ordering. You can plug-in this update manager through
the "openjpa.jdbc.UpdateManager" property. Or you can plug-in your own
statement batching implementation by providing the implementation that extends
from AbstractUpdateManager or ConstraitUpdateManager. Add this implementation
from AbstractUpdateManager, ConstraitUpdateManager or OperationOrderUpdateManager.
Add this implementation
class as a property in the persistence.xml file. For example, a custom
statement batching implementation mycomp.MyUpdateManager extends
ConstraitUpdateManager. You specify this implementation in the persistence.xml