In the 2.0 spec it says... "It is the responsibility of the Container to throw the java.lang.IllegalStateException when a method of the java.util.Collection API is used to access a collection- valued cmr-field within a transaction context other than the transaction context in which the cmr-field was initially materialized." It has a similar point about Iterators. I am not sure what is meant here, can someone shed some light on this. thanks, Jehan
Sure. Let's say, your client (servlet, most often) calls a bean and gets a collection of local-refs from the CMR field. Let it be User->Credit Cards Now, if you try to iterate over credit card interfaces in the servlet, you will get the mentioned exception. To rehash - you can get such a collection in a session bean method, and you must iterate over it in that samethread of execution (generally, it will be the same business method). There are more complex issues with client initiated transactions, but most often these cases do not follow the best-practices design. A general solution is to use a DTO/VO (Data Transfer Object/Value Object) as a return value for your session bean method. Sun currently refer to DTO simply as TO. More info at http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html While this is not required for exam right now (it might be, who knows), it's imperative you know these patterns for practical EJB projects. Good luck
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Devious Experiments for a Truly Passive Greenhouse!