Hi!
According to the that comment below, it is not possible to work with relation sets, if the
calling method ist executed with tx = null.
The getIdList() requires a tx or else the setHandle is always null -> which means that
JBOSS (4.0.2) does not allow something like person.getRelatives().iterator() if the tx is
null.
Can someone confirm this?
public class RelationSet implements Set {
| private JDBCCMRFieldBridge cmrField;
| private EntityEnterpriseContext ctx;
| private List[] setHandle;
| private Class relatedLocalInterface;
|
| //
| // Most of this class is a boring wrapper arround the id set.
| // The only interesting hitch is the setHandle. This class doesn't
| // have a direct referance to the related id set, it has a referance
| // to a referance to the set. When the transaction is completed the
| // CMR field sets my referance to the set to null, so that I know that
| // this set is no longer valid. See the ejb spec for more info.
| //
|
| public RelationSet(
| JDBCCMRFieldBridge cmrField,
| EntityEnterpriseContext ctx,
| List[] setHandle) {
|
| this.cmrField = cmrField;
| this.ctx = ctx;
| this.setHandle = setHandle;
| relatedLocalInterface = cmrField.getRelatedLocalInterface();
| }
|
| private List getIdList() {
| if(setHandle[0] == null) {
| throw new IllegalStateException("A CMR collection may only be used
" +
| "within the transction in which it was created");
| }
|
|
Source:
http://www.cenqua.com/clover/eg/jboss/report/org/jboss/ejb/plugins/cmp/jd...
--
Alex
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974508#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...