Return-Path: Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 67733 invoked by uid 500); 27 Mar 2003 06:13:23 -0000 Received: (qmail 67730 invoked from network); 27 Mar 2003 06:13:23 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 27 Mar 2003 06:13:23 -0000 Received: (qmail 82109 invoked by uid 1520); 27 Mar 2003 06:13:22 -0000 Date: 27 Mar 2003 06:13:22 -0000 Message-ID: <20030327061322.82107.qmail@icarus.apache.org> From: olegnitz@apache.org To: db-ojb-cvs@apache.org Subject: cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/batch BatchConnection.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N olegnitz 2003/03/26 22:13:21 Modified: src/java/org/apache/ojb/broker/util/batch BatchConnection.java Log: Fixed OutOfMemoryError for huge transactions Revision Changes Path 1.9 +13 -2 db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java Index: BatchConnection.java =================================================================== RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- BatchConnection.java 16 Feb 2003 17:28:53 -0000 1.8 +++ BatchConnection.java 27 Mar 2003 06:13:21 -0000 1.9 @@ -89,6 +89,8 @@ */ public class BatchConnection extends WrappedConnection { + private static final int MAX_COUNT = 1000; + /** * Maps PBKey to another HashMap, * which maps table name to List of related tables (N:1 or 1:1) @@ -101,6 +103,7 @@ private HashMap _fkInfo; private HashSet _deleted; private HashSet _dontInsert; + private int count = 0; public BatchConnection(Connection conn, PersistenceBroker broker) { @@ -152,7 +155,15 @@ */ void nextExecuted(String sql) throws SQLException { - if (_order.contains(sql)) { + count++; + if (count == MAX_COUNT) + { + executeBatch(); + count = 0; + } + + if (_order.contains(sql)) + { return; }