Assert.assertNotSame(a1, personEntity, "New object was not created by merge().");
}
@Test
public void testMergeInSeparateTx() {
PersonEntity personEntity = new PersonEntity();
personEntity.setName("testMergeInSeparateTx");
EntityTransaction tx = em.getTransaction();
tx.begin();
em.persist(personEntity);
tx.commit();
String persistPersonEntityId = personEntity.getId();
personEntity.setName("testMergeInSeparateTxUpdate");
tx = em.getTransaction();
tx.begin();
em.merge(personEntity);
tx.commit();
Assert.assertEquals(personEntity.getId(), persistPersonEntityId,
"Created new entity in separate transaction merge.");
}