Hi
I've pasted provisioning method, and atached data objects classes, i hope that it helps
public void testDbProvisioning() {
long time = System.currentTimeMillis();
System.out.println(Thread.currentThread().getName() + "--testDbProvisioning");
long picturesToAddNumber = Integer.parseInt(System.getProperty("picturesNumber"));
int shapesPerNumber = Integer.parseInt(System.getProperty("shapesNumber"));
PersistenceManager pm = pmf.getPersistenceManager();
// pm.addInstanceLifecycleListener(new JDOLifecycleListener(), null);
pm.currentTransaction().begin();
List<Color> colors = new ArrayList<Color>();
for (int i = 0; i < 20; i++) {
colors.add(new Color(i, i + 2, i - 3));
}
for (int p = 0; p < picturesToAddNumber; p++) {
Picture picture = new Picture();
Square canvas = new Square(picture, 400);
canvas.setBackgroundColour(colors.get(0));
picture.setCanvas(canvas);
for (int i = 0; i < shapesPerNumber; i++) {
Triangle triangle = new Triangle(picture, i % 100);
triangle.setBackgroundColour(colors.get(i % colors.size()));
triangle.setColorForLines(colors);
picture.getShapes().add(triangle);
Square square = new Square(picture, i % 100);
square.setBackgroundColour(colors.get(i % colors.size()));
square.setColorForLines(colors);
picture.getShapes().add(square);
Polygon polygon = new Polygon(picture, i % 10, 1 % 100);
polygon.setBackgroundColour(colors.get(i % colors.size()));
polygon.setColorForLines(colors);
picture.getShapes().add(polygon);
}
pm.makePersistent(picture);
if ((p % 100) == 0) {
System.out.println("Cache size before flush = " + pm.getManagedObjects().size());
System.out.println(JDOHelper.getObjectState(picture));
pm.currentTransaction().commit();
System.out.println(JDOHelper.getObjectState(picture));
pm.currentTransaction().begin();
System.out.println("Cache size after flush = " + pm.getManagedObjects().size());
System.out.println(JDOHelper.getObjectState(picture));
pm.evictAll();
System.out.println(JDOHelper.getObjectState(picture));
System.out.println("Cache size after pm.evict = " + pm.getManagedObjects().size());
pmf.getDataStoreCache().evictAll();
System.out.println(Thread.currentThread().getName() + " --" + "flush " + p);
}
}
if (rollbackOnly) {
pm.currentTransaction().rollback();
System.out.println(Thread.currentThread().getName() + " --" + "provisioning rollback");
} else {
pm.currentTransaction().commit();
System.out.println(Thread.currentThread().getName() + " --" + "provisioning commit");
}
System.out.println("Elapsed time : " + (System.currentTimeMillis() - time));
long numOfPicturesAfter = countObjects(pm, Picture.class);
System.out.println(Thread.currentThread().getName() + " --" + "Total Pictures: " + numOfPicturesAfter);
pm.close();
}