You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephen Hogarth <SH...@slb.com> on 2010/06/24 23:31:39 UTC

Accessing tapestry's hibernate instance from a quartz job

I have a T5 application connected to a database using hibernate working fine. To perform background operations on the database, I have a quartz scheduler servlet included in the same project that calls the background job as expected. I would like to get an instance of tapestry's hibernate session to access the database and reference the same entity objects. Is it possible to get an instance of tapestry's hibernate session from this quartz job?

I have searched google and the mailing list but haven't found an answer to this yet. I know straight injection doesn't work. I have found a way to manually setup a second hibernate instance but that requires some duplicate settings and a set of hbm.xml files that aren't required by tapestry. Using this second way seems a lot of extra work and a maintenance nightmare if there is a way to get tapestry's hibernate instance.

Re: Accessing tapestry's hibernate instance from a quartz job

Posted by "greg@liftyourgame.com" <gr...@liftyourgame.com>.
Hi Howard,

Are you still going to release your Quartz / Hibernate module for Tapestry?

Regards,

Greg.


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-s-hibernate-instance-from-a-quartz-job-tp2421535p4552022.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Accessing tapestry's hibernate instance from a quartz job

Posted by Kalle Korhonen <ka...@gmail.com>.
Chenillekit provides Quartz integration module -
http://chenillekit.codehaus.org/chenillekit-quartz/index.html. Been
using it for more than a year now.

Kalle


On Thu, Jun 24, 2010 at 7:32 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> Well, within a single JVM, Tapestry IoC service proxies will serialize
> and de-serialize correctly. So, you can inject the Session into some
> code that creates a Quartz job, storing the Session in an instance
> variable.
>
> However, you'll miss out on a few things; you need a wrapper around
> executing Quartz jobs, one that invokes the PerThreadManager's
> cleanup() method. This makes sure per-thread object instances are
> properly discarded.
>
> I'll be doing some work in Quartz (w/ Hibernate) in the near future
> and I expect to spin off what I write into a tapx module, and a
> Tapestry module in the 5.3 timeframe.
>
> On Thu, Jun 24, 2010 at 2:31 PM, Stephen Hogarth <SH...@slb.com> wrote:
>> I have a T5 application connected to a database using hibernate working fine. To perform background operations on the database, I have a quartz scheduler servlet included in the same project that calls the background job as expected. I would like to get an instance of tapestry's hibernate session to access the database and reference the same entity objects. Is it possible to get an instance of tapestry's hibernate session from this quartz job?
>>
>> I have searched google and the mailing list but haven't found an answer to this yet. I know straight injection doesn't work. I have found a way to manually setup a second hibernate instance but that requires some duplicate settings and a set of hbm.xml files that aren't required by tapestry. Using this second way seems a lot of extra work and a maintenance nightmare if there is a way to get tapestry's hibernate instance.
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Accessing tapestry's hibernate instance from a quartz job

Posted by Howard Lewis Ship <hl...@gmail.com>.
Well, within a single JVM, Tapestry IoC service proxies will serialize
and de-serialize correctly. So, you can inject the Session into some
code that creates a Quartz job, storing the Session in an instance
variable.

However, you'll miss out on a few things; you need a wrapper around
executing Quartz jobs, one that invokes the PerThreadManager's
cleanup() method. This makes sure per-thread object instances are
properly discarded.

I'll be doing some work in Quartz (w/ Hibernate) in the near future
and I expect to spin off what I write into a tapx module, and a
Tapestry module in the 5.3 timeframe.

On Thu, Jun 24, 2010 at 2:31 PM, Stephen Hogarth <SH...@slb.com> wrote:
> I have a T5 application connected to a database using hibernate working fine. To perform background operations on the database, I have a quartz scheduler servlet included in the same project that calls the background job as expected. I would like to get an instance of tapestry's hibernate session to access the database and reference the same entity objects. Is it possible to get an instance of tapestry's hibernate session from this quartz job?
>
> I have searched google and the mailing list but haven't found an answer to this yet. I know straight injection doesn't work. I have found a way to manually setup a second hibernate instance but that requires some duplicate settings and a set of hbm.xml files that aren't required by tapestry. Using this second way seems a lot of extra work and a maintenance nightmare if there is a way to get tapestry's hibernate instance.
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org