Hi,
I have found a work-around for the differed (defered) inserts imposed
from JBOSS in a REQUESTS_NEW-CMT context:
...
// beans created and PK generated from DB (id-seq) [every bean
// have the "id" Integer-pk-prop]
ABean oABean = new ABean();
BBean oBBean = null;
CBean oCBean = null;
m_oEM.persist(oABean);
m_oEM.persist((oBBean = new BBean(oABean)));
m_oEM.persist((oCBean = new CBean(oABean, oBBean)));
// at this point beans are NOT already writed to DB and an
// EJB-query, via the obtained ids, retrieve nothing
// inform the PesistenceManager (PM) that the beans are ready to insert
m_oEM.flush();
// request to PM to re-read beans from DB (this force PM to check
// that beans are ready for write, wrote them, and reload them)
m_oEM.refresh(oABean);
m_oEM.refresh(oBBean);
m_oEM.refresh(oCBean);
// NOW we can execute the SELECT for obtain ALSO the new BBean!
Set aoBBean = ABean.getBBeans();
...
It works (on JBOSS 4.0.4RC1) but It seem counter-intuitive.
Is this the correct way to do this thinks
TIA
Roberto Colmegna