Hi,
I've set up a straightfroward one-to-many CMR relationship with two
Entity Beans on JBoss 4 (XDoclet declarations at the end of this post).
Calling the CMR method getAddenda() that returns the Set works
perfectly from another bean, but I would like to call it from custom
JSP tags in the web tier of the same server. When I try this, I get the
following exception:
A CMR collection may only be used within the transction in which it was
created
What do I have to do to call this method from the web tier? A sample
would be great.
Could you point me to documentation explaining this CMR restriction?
Thanks,
blu
In bean Project:
/**
* @ejb.interface-method
*
* @ejb.relation
* name="Project-Addenda"
* role-name="Project-has-many-Addenda"
* target-ejb="Addendum"
* target-role-name="Addendum-belongs-to-Project"
*/
public abstract Set getAddenda();
In bean Addendum:
/**
* @ejb.interface-method
*
* @ejb.relation
* name="Project-Addenda"
* role-name="Addendum-belongs-to-Project"
* target-ejb="Project"
* target-role-name="Project-has-many-Addenda"
* cascade-delete="yes"
*
* @jboss.relation
* related-pk-field="planKey"
* fk-column="plan_key"
* fk-constraint="false"
*/
public abstract ProjectLocal getProject();
Marek Lange - 26 Jan 2005 09:37 GMT
> Hi,
>
[quoted text clipped - 11 lines]
>
> Could you point me to documentation explaining this CMR restriction?
You have to use value objects since the cmr instance can't be used
outside your transaction. Look at the EJB spec where this restriction is
explained.
-marek