Is this a waste of resources here? This code is called from a session bean, getting a list of orders from an entity bean. This snipit is from a private method which returns a list of orders. It seems to me this would do double work. I understand that the container may do some caching of the entity references themselves, but won't this go to the DB a second time?
posted 12 years ago
Even if the container would actually cache the result, there's no good reason to rely on such behavior. I would definitely prefer something like