}
private void unknownCmpText() throws Exception {
beginTx();
UnknownCmpBean unknownCmpBean = new UnknownCmpBean_Subclass();
unknownCmpBean.ejbCreateObject("Joe Blow");
assertFalse(entityManager.contains(unknownCmpBean));
entityManager.persist(unknownCmpBean);
// extract primary key seems to require a flush followed by a merge
entityManager.flush();
unknownCmpBean = entityManager.merge(unknownCmpBean);
final Object joeId = unknownCmpBean.getPrimaryKey();
assertTrue(entityManager.contains(unknownCmpBean));
commitTx();
beginTx();
unknownCmpBean = new UnknownCmpBean_Subclass();
unknownCmpBean.ejbCreateObject("Lloyd Dobler");
assertFalse(entityManager.contains(unknownCmpBean));
entityManager.persist(unknownCmpBean);
// extract primary key seems to require a flush followed by a merge
entityManager.flush();
unknownCmpBean = entityManager.merge(unknownCmpBean);
final Object lloydId = unknownCmpBean.getPrimaryKey();
assertTrue(entityManager.contains(unknownCmpBean));
commitTx();
beginTx();
final UnknownCmpBean joe = (UnknownCmpBean) entityManager.createQuery("select e from UnknownCmpBean_Subclass e where e.firstName='Joe'").getSingleResult();
assertTrue(entityManager.contains(joe));
assertEquals(joe.getPrimaryKey(), joeId);
assertEquals(joe.getFirstName(), "Joe");
assertEquals(joe.getLastName(), "Blow");
final UnknownCmpBean lloyd = (UnknownCmpBean) entityManager.createQuery("select e from UnknownCmpBean_Subclass e where e.firstName='Lloyd'").getSingleResult();
assertTrue(entityManager.contains(lloyd));
assertEquals(lloyd.getPrimaryKey(), lloydId);
assertEquals(lloyd.getFirstName(), "Lloyd");
assertEquals(lloyd.getLastName(), "Dobler");
commitTx();
}