commitTxn();
}
public void testUnencodedLongPk_BatchGet() throws EntityNotFoundException {
switchDatasource(EntityManagerFactoryName.nontransactional_ds_non_transactional_ops_allowed);
HasLongPkJPA pojo = new HasLongPkJPA();
beginTxn();
pojo.setId(1L);
em.persist(pojo);
commitTxn();
HasLongPkJPA pojo2 = new HasLongPkJPA();
beginTxn();
pojo2.setId(2L);
em.persist(pojo2);
commitTxn();
assertNotNull(pojo.getId());
assertNotNull(pojo2.getId());
beginTxn();
Query q = em.createQuery("select from " + HasLongPkJPA.class.getName() + " b where id = :ids");
q.setParameter("ids", Utils.newArrayList(pojo.getId(), pojo2.getId()));
List<HasLongPkJPA> pojos = (List<HasLongPkJPA>) q.getResultList();
assertEquals(2, pojos.size());
// we should preserve order but right now we don't
Set<Long> pks = Utils.newHashSet(pojos.get(0).getId(), pojos.get(1).getId());
assertEquals(pks, Utils.newHashSet(1L, 2L));