What is the best/optimized way (with regards to performance) to retrieve an object, by using 'retrieve by association' or 'retrieve from database'? If I understand correctly.. - If I have made changes to an association I can retrieve these uncommitted changes only by using a 'retrieve by association'. - If the object is not in the memory it will always be retrieved from database. - If I need the most updated state of an object, it should always be retrieved from the database. Something else that I am missing? Are there any best practices or a clear distinction about where to use one of the two? Best, Jasleen
Over association is almost always faster then doing a database retrieve. But as you stated yourself if some other process can also change that object and you want to make sure you have the latest data you use the retrieve from database action.
So it depends very much on what you are doing, but I always use the retrieve by association unless...