}
private void cmpText() throws Exception {
beginTx();
BasicCmpBean basicCmpBean = new BasicCmpBean_Subclass();
basicCmpBean.ejbCreateObject("Joe Blow");
assertFalse(entityManager.contains(basicCmpBean));
entityManager.persist(basicCmpBean);
// extract primary key seems to require a flush followed by a merge
entityManager.flush();
basicCmpBean = entityManager.merge(basicCmpBean);
final int joeId = basicCmpBean.getPrimaryKey();
assertTrue(entityManager.contains(basicCmpBean));
commitTx();
beginTx();
basicCmpBean = new BasicCmpBean_Subclass();
basicCmpBean.ejbCreateObject("Lloyd Dobler");
assertFalse(entityManager.contains(basicCmpBean));
entityManager.persist(basicCmpBean);
// extract primary key seems to require a flush followed by a merge
entityManager.flush();
basicCmpBean = entityManager.merge(basicCmpBean);
final int lloydId = basicCmpBean.getPrimaryKey();
assertTrue(entityManager.contains(basicCmpBean));
commitTx();
beginTx();
final BasicCmpBean joe = (BasicCmpBean) entityManager.createQuery("select e from BasicCmpBean_Subclass e where e.primaryKey=" + joeId).getSingleResult();
assertTrue(entityManager.contains(joe));
assertEquals(joe.getPrimaryKey(), joeId);
assertEquals(joe.getFirstName(), "Joe");
assertEquals(joe.getLastName(), "Blow");
final BasicCmpBean lloyd = (BasicCmpBean) entityManager.createQuery("select e from BasicCmpBean_Subclass e where e.primaryKey=" + lloydId).getSingleResult();
assertTrue(entityManager.contains(lloyd));
assertEquals(lloyd.getPrimaryKey(), lloydId);
assertEquals(lloyd.getFirstName(), "Lloyd");
assertEquals(lloyd.getLastName(), "Dobler");
commitTx();
}