We don't want every business class writing its own persistence; we use many developers for business classes, and want them to be able to concentrate on business issues, not having to worry about persistence. So we (and many others in similar situations), made a superclass called PersistentObject, which contained the protocol, caught the "save this object" message, etc. Good trick, and reasonably obvious application of encapsulation, inheritance, etc. Downside is you have to have source code and recompile to change the PersistenceMechanism, unlike ContainerManagedPersistence (as I understand it). -- AlistairCockburn ''If you want to use different a QueryLanguage / QueryApi you still need to recompile, even with ContainerManagedPersistence, there is no way around that '' ---- In ComponentBasedDevelopment, sometimes inheritance isn't possible, so you can't directly reuse a superclass like PersistentObject. For instance, COM doesn't have inheritance. This causes you to do component reuse ways like these: * ComponentManagedPersistence, using components like ADO (ActiveX Data Objects) to read/write data to/from any kind of OLEDB provider, or using things like Orbix to get to another component model's server object, which in turn reads and writes to and from persistence. * ContainerManagedPersistence, when contained components implement an interface like IPersistStream, which allows your container to ask you to serialize to/from a stream, or IPersistStorage, which gives you more structured persistence. * Both ComponentManagedPersistence and ContainerManagedPersistence. Sometimes, the stateless container (e.g., a web browser with stateless HTML) force exists. It may only provide context-setting properties. Just enough to find a remote server. Depending on your context, you can use one or a combination of the above in conjunction with others to get the job done in a way that balances prevailing forces. -- PhilipEskelin ---- Understanding Object Persistence *http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/_html/undtldev008.htm ---- This is useful in languages that have little or no support for reflection. In reflective languages, object persistence is implemented by PersistenceMapping. ---- CategoryPersistence