Niclas, and Alexis:
You may be suprised to know that in the past I have used the context object to pass a persistent value to a component that maintain a persistent state.
I have not used the ServiceManager bacause I'm not providing a service to the component.
I don't know OJB and Hibernate but I do know PSS (Persistent State Service) and what PSS lets me do is to establish a value object that I can use to encapsulate state. If I pass the value to a component as part of the supplied context - I am saying - "here is the instance that makes up part of the component state". The logical question from this is "how do you establish the state value instance?". Well - components are created to handle requests (i.e. provide services) but in the case of a persistent component we are talking about an identifiable component. Therefore we have a home component (a component that understands the an identify relative to a particular scope). The home component handles the request for a service relative to an identity. This gets translated into the establishment of a component with a context entry corresponding to the identity state.
Cheers, Steve.
Niclas Hedhman wrote:
On Saturday 01 November 2003 17:14, Alexis Agahi wrote:
Hi,
As I'm now using hibernate on current biz project, some ideas come to my brain about how could have transparent persistence with avalon compenent.
Based on hibernate (JDO?) approach that all object could be mapped in database with get/setter method to populate the object field from db (or persist state to db), any component could support such feature.
The main problem would be how manage compenent persistance. I have a suggestion: via a Persitence interface that could be added in component lifecycle.
such as public interface Persistence { public void persitence( PersistenceManager persistenceManager ); }
PersistenceManager class would manage object persistance/lookup(load) and
transaction provider.
Although I am pretty keen on getting into a Persistence model for component's value objects (as the component itself rarely is persistable), I fail to see the need for a extension of Avalon Framework.
IMHO, the PersistenceManager is just any Avalon component, which is configured the normal way, and looked up via the ServiceManager by components that requires it.
I don't see the difference (other than casting) of;
public void service( ServiceManager sm )
{ m_ServiceManager = sm; }
public void persistence( PersistenceManager pm )
{
m_Persistence = pm;
// snip }
and
public void service( ServiceManager sm ) { m_ServiceManager = sm; m_Persistence = (PersistenceManager) sm.lookup( PersistenceManager.ROLE); }
Please elaborate what is the benefit?
Niclas
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Stephen J. McConnell mailto:[EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
