you should have 2 options:
  1. inject the session factory into the timertask, call
constructCoreServiceImplementation() and call the lifecycle-methods of the
proxy this gave you manually (not so nice)

  2. inject the hibernate-session and make sure that Registry.setupThread()
and Registry.cleanupThread() are called in the TimerTask's run() method (at
the start & end resp.) For that you'll need access to tapestry's hivemind
registry (I think you'll have to subclass the AppServlet for htat) or you
can let your Timer have its own registry (not so nice because that'll give
you 2 instances of the session-factory with all the overhead)

bottom-line:
I think it would be nice if tapestry put the registry into the JNDI tree
(optionally). 

> -----Original Message-----
> From: =?ISO-8859-13?Q?b=EBgantis_debesis?= [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 19, 2006 5:05 PM
> To: Tapestry users
> Subject: Re: honeycomb: acquiring session not in a tapestry page
> 
> 
> I use java.util.Timer to run the periodical task. I don't 
> really need more
> features that quatz has (and more dependancies).
> I thought I could just acquire SessionFactory from the 
> registry, and invoke
> getSessionFactory method, but this method is protected.
> 
> 
> If I understand correctly, when I make my task a hivemind 
> service and inject
> session factory, I get access to the HibernateSessionFactory 
> object, but how
> do I get a session from it?
> Can I inject the session? It doesn't feel correct.
> 
> Any suggestions?
> 
> Thanks,
> Valdemaras
> 
> 
> 
> 
> On 4/19/06, James Carman <[EMAIL PROTECTED]> wrote:
> >
> > How do you run your background process?
> >
> > > Hi,
> > > I started using honeycomb on my project as a 
> tapestry/hibernate glue.
> > > Before
> > > that, I just had a HibernateUtil with sessionFactory 
> initialization and
> > so
> > > on..manual transaction management.
> > > The thing is, I need a session in other background 
> process, which is not
> > a
> > > web page, just a periodical task. Can I get a session 
> there without
> > > creating
> > > a separate HibernateSessionFactory (one is created by 
> honeycomb in its
> > > session factory service)?
> > >
> > > Thanks in advance,
> > > Valdemaras
> > >
> >
> >
> > James Carman, President
> > Carman Consulting, Inc.
> >
> >
> > 
> ---------------------------------------------------------------------
> > 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]

Reply via email to