The SPF creates a proxy that accesses another service, and a property provided by that service. If the HibernateSession service is threaded and HibernateService is not, then *every* access to the HibernateSession service will, potentially, cause a new Hibernate session object to be created.
But I might be missing something; I was looking for a reasonable example, but I don't know the Hibernate APIs off the top of my head. On Mon, 9 Aug 2004 13:45:53 -0400, Harish Krishnaswamy <[EMAIL PROTECTED]> wrote: > Why not make the HibernateSession service threaded and have the SPF go > to the HibernateService (which is essentially a hibernate session > factory service) to get a session? Why does a threaded service need to > be isolated? I guess I am missing something while trying to avoid the > wrapper service. > > -Harish > > > > On Mon, 9 Aug 2004 13:08:11 -0400, Howard Lewis Ship <[EMAIL PROTECTED]> > wrote: > > Yes. My reasoning on why this is better: > > > > If you have a threaded service, say HibernateSessionHolder, which has > > getSession() and setSession() methods, then you can make use of > > ServicePropertyFactory. > > > > SPF can access the session proeprty of HibernateSessionHolder, to form > > a new service, HibernateSession ... whose interface is > > hibernate.Session. > > > > This hibernate.Session instance is a wrapper around your threaded > > holder service and, ultimately, the actual Session object. > > > > You can inject the HibernateSession service into your code directly. > > You can then access the Hibernate Session "normally" ... you don't > > have to de-reference through a holder service, or through a > > ThreadLocalMap or anything. > > > > This will clarify and simplify your code and make it easier to test > > (your only have to mock hibernate.Session, not ThreadLocalMap or any > > of the rest). > > > > The bridge service, created by SPF, isolates the service that is > > threaded from the other services, which can be ordinary singletons. > > > > On Mon, 9 Aug 2004 11:32:52 -0400, Harish Krishnaswamy > > > > > > <[EMAIL PROTECTED]> wrote: > > > Which means I have to have a threaded service now to wrap a thread > > > local item like the Hibernate session? > > > > > > -Harish > > > > > > > > > > > > On Mon, 9 Aug 2004 10:31:35 -0400, Howard Lewis Ship <[EMAIL PROTECTED]> > > > wrote: > > > > In the dept. of general cleanups ... ThreadLocalStorage seemed like a > > > > good idea at the time, but with service-property:, > > > > ServicePropertyFactory and threaded/pooled services it doesn't seem to > > > > be such a good idea. I don't forsee myself ever using it and would > > > > like to remove it. thoughts? > > > > -- > > > > Howard M. Lewis Ship > > > > Independent J2EE / Open-Source Java Consultant > > > > Creator, Jakarta Tapestry > > > > Creator, Jakarta HiveMind > > > > http://howardlewisship.com > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > > Howard M. Lewis Ship > > Independent J2EE / Open-Source Java Consultant > > Creator, Jakarta Tapestry > > Creator, Jakarta HiveMind > > http://howardlewisship.com > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator, Jakarta Tapestry Creator, Jakarta HiveMind http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
