You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by pdennis <pa...@managementdynamics.com> on 2008/02/29 20:50:34 UTC

Initialize Hibernate During Deployment

I followed the JBoss to  
http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate-migration.html
Geronimo Hibernate Migration  to get Hibernate working in Geronimo, and it
works just great.  My only problem is the first time I use Hibernate in my
web application, it has to initialize which takes about 2 minutes. 

My question is, how do I get Geronimo to initialize Hibernate when I deploy
my WAR, or when the WAR starts up (when Geronimo is restarted).  Has anyone
ever done this?

Thanks,

Patrick 
-- 
View this message in context: http://www.nabble.com/Initialize-Hibernate-During-Deployment-tp15766273s134p15766273.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Initialize Hibernate During Deployment

Posted by David Jencks <da...@yahoo.com>.
On Mar 3, 2008, at 10:05 AM, pdennis wrote:

>
> Hi David,
>
> Thanks, that did work for me.
>
> After your last post about listeners, I found this
> http://publib.boulder.ibm.com/wasce/V2.0.0/en/lifecycle- 
> listeners.html#Lifecyclelisteners-webapp
> article  about life cycle listeners, and I had a deploy error with the
> <gbean> tags.
Hmmm..... I would have hoped that this bit of documentation could  
have discussed when you would use the standard jee listeners  
available to any web app and when you would need a proprietary tomcat  
extension accessed through a proprietary geronimo configuration  
method.  Basically unless you have to get into really deep geronimo  
internals you are better off with the jee listeners configured in  
your web.xml.  If you have to use some geronimo internals you can  
arrange to look up a gbean in jndi.


>
> Your solution was app server independent and much easier to implement.
>

glad the simpler solution worked.

thanks
david jencks

> Thanks,
>
> Patrick
>
>
> djencks wrote:
>>
>>
>> On Mar 3, 2008, at 7:20 AM, pdennis wrote:
>>
>>>
>>> Hi David,
>>>
>>> I do know what Hibernate is doing, it is reading the
>>> hibernate.cfg.xml file,
>>> reading up the mapping files and creating a
>>> org.hibernate.SessionFactory.
>>> All of this is in a static method in my HibernateUtil class.  This
>>> is how
>>> Hibernate works with other app servers (as far as I know).
>>>
>>> What kind of listener do I need to create that gets triggered when
>>> the app
>>> starts?  This sounds like what I'm trying to do.
>>
>> I would think that if you included a load-on-startup element for one
>> of your servlets and called the static method in initialize() from
>> that servlet it would get called when the app is started?  Maybe I'm
>> missing something obvious.
>>
>> thanks
>> david jencks
>>
>>>
>>> -Patrick
>>>
>>>
>>> djencks wrote:
>>>>
>>>> Do you have any idea what hibernate is doing?  Does this happen on
>>>> other app servers?
>>>>
>>>> If you can figure out what is triggering the initialization you  
>>>> might
>>>> be able to trigger it in a listener so it happens when the app
>>>> starts.
>>>>
>>>> thanks
>>>> david jencks
>>>>
>>>> On Feb 29, 2008, at 11:50 AM, pdennis wrote:
>>>>
>>>>>
>>>>> I followed the JBoss to
>>>>> http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate-
>>>>> migration.html
>>>>> Geronimo Hibernate Migration  to get Hibernate working in  
>>>>> Geronimo,
>>>>> and it
>>>>> works just great.  My only problem is the first time I use
>>>>> Hibernate in my
>>>>> web application, it has to initialize which takes about 2 minutes.
>>>>>
>>>>> My question is, how do I get Geronimo to initialize Hibernate when
>>>>> I deploy
>>>>> my WAR, or when the WAR starts up (when Geronimo is restarted).
>>>>> Has anyone
>>>>> ever done this?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Patrick
>>>>> -- 
>>>>> View this message in context: http://www.nabble.com/Initialize-
>>>>> Hibernate-During-Deployment-tp15766273s134p15766273.html
>>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context: http://www.nabble.com/Initialize-
>>> Hibernate-During-Deployment-tp15766273s134p15806149.html
>>> Sent from the Apache Geronimo - Users mailing list archive at
>>> Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Initialize- 
> Hibernate-During-Deployment-tp15766273s134p15809812.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: Initialize Hibernate During Deployment

Posted by pdennis <pa...@managementdynamics.com>.
Hi David,

Thanks, that did work for me.

After your last post about listeners, I found this 
http://publib.boulder.ibm.com/wasce/V2.0.0/en/lifecycle-listeners.html#Lifecyclelisteners-webapp
article  about life cycle listeners, and I had a deploy error with the
<gbean> tags.

Your solution was app server independent and much easier to implement.

Thanks,

Patrick


djencks wrote:
> 
> 
> On Mar 3, 2008, at 7:20 AM, pdennis wrote:
> 
>>
>> Hi David,
>>
>> I do know what Hibernate is doing, it is reading the  
>> hibernate.cfg.xml file,
>> reading up the mapping files and creating a  
>> org.hibernate.SessionFactory.
>> All of this is in a static method in my HibernateUtil class.  This  
>> is how
>> Hibernate works with other app servers (as far as I know).
>>
>> What kind of listener do I need to create that gets triggered when  
>> the app
>> starts?  This sounds like what I'm trying to do.
> 
> I would think that if you included a load-on-startup element for one  
> of your servlets and called the static method in initialize() from  
> that servlet it would get called when the app is started?  Maybe I'm  
> missing something obvious.
> 
> thanks
> david jencks
> 
>>
>> -Patrick
>>
>>
>> djencks wrote:
>>>
>>> Do you have any idea what hibernate is doing?  Does this happen on
>>> other app servers?
>>>
>>> If you can figure out what is triggering the initialization you might
>>> be able to trigger it in a listener so it happens when the app  
>>> starts.
>>>
>>> thanks
>>> david jencks
>>>
>>> On Feb 29, 2008, at 11:50 AM, pdennis wrote:
>>>
>>>>
>>>> I followed the JBoss to
>>>> http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate-
>>>> migration.html
>>>> Geronimo Hibernate Migration  to get Hibernate working in Geronimo,
>>>> and it
>>>> works just great.  My only problem is the first time I use
>>>> Hibernate in my
>>>> web application, it has to initialize which takes about 2 minutes.
>>>>
>>>> My question is, how do I get Geronimo to initialize Hibernate when
>>>> I deploy
>>>> my WAR, or when the WAR starts up (when Geronimo is restarted).
>>>> Has anyone
>>>> ever done this?
>>>>
>>>> Thanks,
>>>>
>>>> Patrick
>>>> -- 
>>>> View this message in context: http://www.nabble.com/Initialize-
>>>> Hibernate-During-Deployment-tp15766273s134p15766273.html
>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Initialize- 
>> Hibernate-During-Deployment-tp15766273s134p15806149.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Initialize-Hibernate-During-Deployment-tp15766273s134p15809812.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Initialize Hibernate During Deployment

Posted by David Jencks <da...@yahoo.com>.
On Mar 3, 2008, at 7:20 AM, pdennis wrote:

>
> Hi David,
>
> I do know what Hibernate is doing, it is reading the  
> hibernate.cfg.xml file,
> reading up the mapping files and creating a  
> org.hibernate.SessionFactory.
> All of this is in a static method in my HibernateUtil class.  This  
> is how
> Hibernate works with other app servers (as far as I know).
>
> What kind of listener do I need to create that gets triggered when  
> the app
> starts?  This sounds like what I'm trying to do.

I would think that if you included a load-on-startup element for one  
of your servlets and called the static method in initialize() from  
that servlet it would get called when the app is started?  Maybe I'm  
missing something obvious.

thanks
david jencks

>
> -Patrick
>
>
> djencks wrote:
>>
>> Do you have any idea what hibernate is doing?  Does this happen on
>> other app servers?
>>
>> If you can figure out what is triggering the initialization you might
>> be able to trigger it in a listener so it happens when the app  
>> starts.
>>
>> thanks
>> david jencks
>>
>> On Feb 29, 2008, at 11:50 AM, pdennis wrote:
>>
>>>
>>> I followed the JBoss to
>>> http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate-
>>> migration.html
>>> Geronimo Hibernate Migration  to get Hibernate working in Geronimo,
>>> and it
>>> works just great.  My only problem is the first time I use
>>> Hibernate in my
>>> web application, it has to initialize which takes about 2 minutes.
>>>
>>> My question is, how do I get Geronimo to initialize Hibernate when
>>> I deploy
>>> my WAR, or when the WAR starts up (when Geronimo is restarted).
>>> Has anyone
>>> ever done this?
>>>
>>> Thanks,
>>>
>>> Patrick
>>> -- 
>>> View this message in context: http://www.nabble.com/Initialize-
>>> Hibernate-During-Deployment-tp15766273s134p15766273.html
>>> Sent from the Apache Geronimo - Users mailing list archive at
>>> Nabble.com.
>>>
>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Initialize- 
> Hibernate-During-Deployment-tp15766273s134p15806149.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: Initialize Hibernate During Deployment

Posted by pdennis <pa...@managementdynamics.com>.
Hi David,

I do know what Hibernate is doing, it is reading the hibernate.cfg.xml file,
reading up the mapping files and creating a org.hibernate.SessionFactory. 
All of this is in a static method in my HibernateUtil class.  This is how
Hibernate works with other app servers (as far as I know).  

What kind of listener do I need to create that gets triggered when the app
starts?  This sounds like what I'm trying to do.

-Patrick


djencks wrote:
> 
> Do you have any idea what hibernate is doing?  Does this happen on  
> other app servers?
> 
> If you can figure out what is triggering the initialization you might  
> be able to trigger it in a listener so it happens when the app starts.
> 
> thanks
> david jencks
> 
> On Feb 29, 2008, at 11:50 AM, pdennis wrote:
> 
>>
>> I followed the JBoss to
>> http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate- 
>> migration.html
>> Geronimo Hibernate Migration  to get Hibernate working in Geronimo,  
>> and it
>> works just great.  My only problem is the first time I use  
>> Hibernate in my
>> web application, it has to initialize which takes about 2 minutes.
>>
>> My question is, how do I get Geronimo to initialize Hibernate when  
>> I deploy
>> my WAR, or when the WAR starts up (when Geronimo is restarted).   
>> Has anyone
>> ever done this?
>>
>> Thanks,
>>
>> Patrick
>> -- 
>> View this message in context: http://www.nabble.com/Initialize- 
>> Hibernate-During-Deployment-tp15766273s134p15766273.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Initialize-Hibernate-During-Deployment-tp15766273s134p15806149.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Initialize Hibernate During Deployment

Posted by David Jencks <da...@yahoo.com>.
Do you have any idea what hibernate is doing?  Does this happen on  
other app servers?

If you can figure out what is triggering the initialization you might  
be able to trigger it in a listener so it happens when the app starts.

thanks
david jencks

On Feb 29, 2008, at 11:50 AM, pdennis wrote:

>
> I followed the JBoss to
> http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate- 
> migration.html
> Geronimo Hibernate Migration  to get Hibernate working in Geronimo,  
> and it
> works just great.  My only problem is the first time I use  
> Hibernate in my
> web application, it has to initialize which takes about 2 minutes.
>
> My question is, how do I get Geronimo to initialize Hibernate when  
> I deploy
> my WAR, or when the WAR starts up (when Geronimo is restarted).   
> Has anyone
> ever done this?
>
> Thanks,
>
> Patrick
> -- 
> View this message in context: http://www.nabble.com/Initialize- 
> Hibernate-During-Deployment-tp15766273s134p15766273.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>