You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian McGovern <bm...@imediainc.com> on 2005/03/29 22:01:39 UTC

RE: Struts , hibernate, and DBCP [solution] - but would like opinions on my approach

I read that.  And that doesn't explain how to create your pool on application server startup.  It only explains how to create a pool on first data call.  

I worked around my problem "in struts" by creating a new base Controller as my action servlet which extends "ActionServlet". 

<servlet-name>action</servlet-name>
<!-- REMOVED DEFAULT  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>--> 
<servlet-class>com.imediainc.pcmexchange.control.PCMBaseControllerServlet</servlet-class>

That Controller servlet is load-on-startup so it executes as my webapp starts.  Inside it it calls my Hibernate session factory which instantiates my pool.  So I do have it worked out that when I start tomcat, my pool is created.  But im not sure this approach is sound.  I'm all ears for alternatives.

In general, I'm new to the concept of extending the struts front controller and don't know if putting a data connection getter in there is a bad practice or not.  I think this would be a good place to instantiate a centralized logger too, etc.

Thanks
-B

-----Original Message-----
From: N G [mailto:nistarguy@gmail.com]
Sent: Tuesday, March 29, 2005 2:36 PM
To: Struts Users Mailing List
Subject: Re: Struts , hibernate, and DBCP


This has nothing to do with Struts:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Good luck,
NG.


On Tue, 29 Mar 2005 13:40:56 -0500, Brian McGovern
<bm...@imediainc.com> wrote:
> Im using struts, hibernate and dbcp connection pooling.  Everything works fine but regarding my connection pool.  It gets intantiated on the first time I request a connection from the DBCP pool.  I want it to create the pool when tomcat starts.  I think i can do this with struts, but im not sure how.  If using struts config for htis is not the answer i;d still like to know what is.
> 
> -thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org