use of io.quarkus.benchmark.model.World in project FrameworkBenchmarks by TechEmpower.
the class WorldRepository method updateAll.
@Transactional
public void updateAll(Collection<World> worlds) {
try (Session s = sf.openSession()) {
s.setJdbcBatchSize(worlds.size());
s.setHibernateFlushMode(FlushMode.MANUAL);
for (World w : worlds) {
s.update(w);
}
s.flush();
}
}
use of io.quarkus.benchmark.model.World in project FrameworkBenchmarks by TechEmpower.
the class WorldRepository method update.
public Uni<Void> update(World[] worlds) {
Arrays.sort(worlds);
List<Tuple> args = new ArrayList<>(worlds.length);
for (World world : worlds) {
args.add(Tuple.of(world.getId(), world.getRandomNumber()));
}
return clients.getPool().preparedQuery("UPDATE World SET randomNumber = $2 WHERE id = $1").executeBatch(args).map(v -> null);
}
use of io.quarkus.benchmark.model.World in project FrameworkBenchmarks by TechEmpower.
the class WorldRepository method createData.
/**
* This method is not required (nor specified) by the benchmark rules,
* but is quite handy to seed a local database and be able to experiment
* with the app locally.
*/
@Transactional
public void createData() {
try (StatelessSession statelessSession = sf.openStatelessSession()) {
final ThreadLocalRandom random = ThreadLocalRandom.current();
for (int i = 1; i <= 10000; i++) {
final World world = new World();
world.setId(i);
world.setRandomNumber(1 + random.nextInt(10000));
statelessSession.insert(world);
}
}
}
Aggregations