18 package com.mysql.clusterj.jpatest;
20 import javax.persistence.Query;
22 import com.mysql.clusterj.jpatest.model.IdBase;
23 import com.mysql.clusterj.jpatest.model.LazyEmployee;
45 private int NUMBER_OF_INSTANCES = 4;
54 em.getTransaction().begin();
55 for (
int i = 0;
i < NUMBER_OF_INSTANCES ; ++
i) {
59 em.getTransaction().commit();
61 em.getTransaction().begin();
62 Query
query = em.createQuery(
"select e from LazyEmployee e where e.id = :id");
63 for (
int i = 0;
i < NUMBER_OF_INSTANCES ; ++
i) {
64 query.setParameter(
"id",
i);
65 LazyEmployee e = (LazyEmployee)query.getSingleResult();
67 int magic = e.getMagic();
80 String result =
new String(
"Lazy Employee " +
id +
" magic: " + magic +
" age: " + age +
" name: " + name);
83 em.getTransaction().commit();
86 private LazyEmployee createLazyEmployee(
int i) {
87 LazyEmployee lazy =
new LazyEmployee();
90 lazy.setName(
"LazyEmployee " + i);