renderJSON(worlds);
}
@play.db.jpa.NoTransaction
public static void setup() {
JPAPlugin plugin = play.Play.plugin(JPAPlugin.class);
plugin.startTx(true);
// clean out the old
World.deleteAll();
System.out.println("DELETED");
// in with the new
for (long i = 0; i <= TEST_DATABASE_ROWS; i++) {
int randomNumber = random.nextInt(TEST_DATABASE_ROWS) + 1;
new World(i, randomNumber).save();
if (i % 100 == 0) {
World.em().flush();
World.em().clear();
System.out.println("FLUSHED : " + i + "/" + TEST_DATABASE_ROWS);
}
}
System.out.println("ADDED");
plugin.closeTx(false);
}