-
1. Re: IllegalStateException Help!
sesques Apr 22, 2004 3:04 AM (in response to bakerma)Post your code snippet, not just saying IT NOT WORK.
-
2. Re: IllegalStateException Help!
akhilanand Jun 12, 2004 2:41 AM (in response to bakerma)hi,
i think you are geeting a collection of localhome objects and then getting an iterator and you are running a while loop over that within which you are type casting the object to the secondary localhome object and then you are applying remove over that, but you do like this
get the collection
get the iterator
while(iterator.hasnext()
{
apply remove method on iterator
}
i too have a same problem and after doing like this it worked fine try this.
with regards
Akhil. -
3. Re: IllegalStateException Help!
bentins Jun 12, 2004 3:28 AM (in response to bakerma)Don't know if it helps but consider this explanation:
When you call upon an entity with some kind of getCollection and receive a collection of locals of another bean you performed a transaction. If you have not opened a transaction outside this call context, say in a session bean, you performed this get in it's own transaction which ended when you finished the get. So now when you try to manipulate this collection it is already outside the transaction context. So, if you make your entity transaction requiered it's not enough, it only states that when you call upon the entity you use a transaction, a transaction is opened for each call separatly.
If you don't want this behavior (and obviously you don't) your best bet is to open a transaction before you manipulate the entity bean and its relations, thus when operating within transaction context the container will not open a new one, and only close it after you finsihed everything you want to do.
The easiest way to do this is to use a session bean facade. Open the transaction on the session bean which will do all the work on the entities and only when it's method is done it will close the transaction.