Menu

retrieveAutomatic=false

2004-10-18
2013-03-07
  • Nobody/Anonymous

    My business object has some collections. I want to use retrieveAutomatic=false for collections. how should I retrieve a collection when the user accesses them?

     
    • Richard Banks

      Richard Banks - 2004-10-18

      1. Don't instantiate the collection when the object is created.

      2. When someone accesses the collection (via the property-get) you should set up a retrieve criteria to load the relevant objects from the database and add them to the collection.  (or you can use one of the getAll methods if appropriate)

      3. Return the collection out of the property-get

      There are other ways to do this, such as instantiating the collection and tracking the lazy load via a flag, etc.

      Hope that helps.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.