public static void setup() {
//JPAPlugin plugin = play.Play.plugin(JPAPlugin.class);
//plugin.startTx(true);
World w = new World() ;
w.getPersistenceManager().beginTransaction();
// clean out the old
World.deleteAll();
System.out.println("DELETED");
// in with the new
List<World> worlds = new ArrayList<World>() ;
for (long i = 0; i <= TEST_DATABASE_ROWS; i++) {
int randomNumber = random.nextInt(TEST_DATABASE_ROWS) + 1;
worlds.add(new World(i, randomNumber));
if (i % 100 == 0) {
World.batch().insert(worlds) ;
System.out.println("FLUSHED : " + i + "/" + TEST_DATABASE_ROWS);
worlds.clear() ;
}
}
System.out.println("ADDED");
//plugin.closeTx(false);
w.getPersistenceManager().commitTransaction();
}