Menu

Retrive all of the database

2004-11-29
2013-03-07
  • Nobody/Anonymous

    Hi.

    How I can retrive an object with all relation, but without use cache. I need retrive in this form to multiuser environment (implements a reload).

     
    • Richard Banks

      Richard Banks - 2004-12-02

      There are a few options

      1.  Clear the cache before making the call.  This is the simplest way.  Use CPersistentBroker.ClearCache()

      2.  When you call the retrieve() method, set the useCache parameter to false.  This will only force a reload of the current object though, and associated objects will still be retrieved from the cache if they are present.   To force all objects to be refreshed from the database, but without clearing the cache first, you would need to override retrieve in your classes to manually load each of the associations without using the cache.

      Option 1 is by far the easiest, and option 2 is a pain in the neck.

       
    • Nobody/Anonymous

      Hi.
      You can create a method to do it ? or I can do it ?

       
    • Richard Banks

      Richard Banks - 2004-12-02

      For option 1, the method is already there, just call it in your code.

      Option 2 requires your own code.  I'm not likely to change the framework to allow this behaviour in the near future since clearing the cache is the best and simlpest option in 99% of cases.

       

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.