You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Török Péter <to...@Allround.net> on 2007/03/12 15:32:31 UTC

Wanted: performance tuning hints

Hello,
I made a small performance test comparing different Cayenne solutions with JDBC solutions. What I found was that in Insert operations, it is best to use Cayenne data objects (as opposed to raw SQL queries), while for Update and Delete the case is the opposite.
So for Insert, this worked best for me:
 
public void insertRecords(int count) {Date date = new Date();

for (int index = 1; index <= count; index++) {

TestData testData = (TestData) context.newObject(TestData.class);

testData.setName(nextName());

testData.setDescription(nextDescription());

testData.setCount(new Integer(count - index));

testData.setCreated(date);

if (index % 1000 == 0) {

context.commitChanges();

}

}

context.commitChanges();

}