Once the ejb method ends the container will also end the associated transaction. Thus making all the entities detached. Then when you try to use variables of the entities which aren't loaded it will throw an LazyInitializationException.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.