Menu

A question about Persistence Methods

2005-07-26
2013-03-07
  • Nobody/Anonymous

    Hello,
    I'm new for the framework, and I'd like to thank all the team for the efforts to give users a good documentation. It helps.

    I have a question which it could seems obvious, but I'd like to know the difference between the Persistence via Inheritance and Persistence via an Pure Object Model.
    What's the difference between the two methods ? does the twos methods use CPersistentObject for brokering or not ?
    Thanks for the answer.
    Here is the text from the documentation, maybe comments on it could be more helpful.

    1) Persistence via the Framework : This method is the easiest to use and offers the most functionality.  It is also the easier method to learn for those who are new to object/relational persistence.
    Using this method your classes inherit the CPersistentObject class in order to gain all of the persistence functionality.

    2) Persistence using a Pure Object Model : There may be reasons where inheriting from a base class is not appropriate.  You may prefer a "pure" object model, you might already inherit from a difference base class or who wish to persist objects using interface definitions instead of class definitions.

    In these situations the framework allows you to persist any class or interface without having to inherit.  There are some limitations and caveats in this approach, but they are easy enough to work around.

     
    • Richard Banks

      Richard Banks - 2005-08-06

      I'm glad you think the documentation is good.  I still think there is a long way to go with it, but lack of time has prevented any real progress over the last few months....

      Brokering occurs in the PersistenceBroker class, not the PersistentObject.  The PeristentObject is used to provide a whole range of base functionality for objects that you wish to persist to/from the database, and makes application code a lot easier to understand since you can call methods directly on the objects.

      Other than that, there are some internal differences related to caching, object status, etc but these can be worked around.

      My personal preference is to inherit from PersistentObject, and then to persist interfaces only when writing plugin's and the like.

      - Richard.

       

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.