I would say what you need is this:

1) A PersistenceManager component bound into Request scope and provided
to components implementing PersistenceAware
- this is the main one, and the others are just there to support the
Hibernate version of this

2) A SessionFactoryManager component bound into application scope and
provided to components implementing SessionFactoryAware -> the
HibernatePersistenceManager should implement SessionFactoryAware

I'm not sure what you need the Configuration one for.... Are you
programmatically changing configuration of Hibernate at runtime? You
could do the same with a HibernateConfigurationManager and a *Aware
interface that the SessionFactoryManager could implement

The components.xml handles all of this for you, right? Why do you need
anything else?

Jason


> -----Original Message-----
> From: Matthew E. Porter [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 07, 2003 8:38 PM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] Is This a Bad Use of IoC?
> 
> 
> I think I may be going Inversion of Control mad lately and need some 
> help sorting out if what I am doing is just wrong.  I am 
> building a new 
> persistence manager where the core manager is based upon hibernate.  
> The hibernate manager needs three different providers- one for 
> Configuration, one for SessionFactory, and one for Sessions.  Each of 
> these providers (Conf, SF, and Session) can have different 
> implementations.  For example, the default Session provider always 
> returns a new session; however, there is also a ThreadLocal version 
> which returns the same session for the entire thread.
> 
> The question I have is how do I specify and load these at 
> runtime?  The 
> most obvious answer is to have a custom xml file that specifies which 
> provider fulfills each role.  I could write (and already have 
> done so) 
> a loader to read an XML file and configure the system.  But, 
> instead of 
> having this in a separate file, would it be a complete bastardization 
> of the intention of IoC (XWork edition) to use it to automatically 
> configure the providers?
> 
> Why does this seem bad?  Because the primary intention of IoC is to 
> wire business components whereas these providers will 
> probably never be 
> used outside the real component, the persistence manager.  
> Instead, it 
> seems like I am too lazy to write a loader to configure the system.
> 
> 
> Cheers,
>    matthew
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites 
> including Data Reports, E-commerce, Portals, and Forums are 
> available now. Download today and enter to win an XBOX or 
> Visual Studio .NET. 
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet
_072303_01/01
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to