-
1. Re: Read only ejbs exception
attachvishal Sep 10, 2002 8:35 AM (in response to bombel)Have u returned the collection of CMR field (means collection of local interfaces) outside the bean where u have defined this relationship
I hade the same problem where i called the abstract CMR method inside the session bean and tried to manupulate the collection of the local interfaces returned by the CMR abstract method -
2. Re: Read only ejbs exception
bombel Sep 10, 2002 9:13 AM (in response to bombel)Yes. I'm iterating over the relation inside session ejb,
and next from each result I'm acquiring value objects
and if it's needed also any other related ejbs.
Anyway if this a problem cause, I think that this behaviour is incorrect. ????? -
3. Re: Read only ejbs exception
dsundstrom Sep 10, 2002 2:01 PM (in response to bombel)The problem is you are having is caused by getting an iterator in one transaction (or no transaction) and using it in another. This behavior and exception are required by the EJB 2.0 specification.
-
4. Re: Read only ejbs exception
bombel Sep 10, 2002 5:40 PM (in response to bombel)I found the very simple solution for this.
When I want to get all CMR related ejbs
I'm not using a collection but simple array:
Object[] tasks_array = testEJBLocal.getTasks().toArray();
next I'm iterating over this array insted of collection and everything is working fine. -
5. Re: Read only ejbs exception
dsundstrom Sep 11, 2002 2:35 PM (in response to bombel)This is a common solution. I usually create a new ArrayList with the relationship collection to get a snapshot. Something like this:
ArrayList snapshot = new ArrayList(testEJBLocal.getTasks());