cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ian.d.stew...@jpmchase.com
Subject Re: Connection Pooling for Spring and Hibernate3
Date Tue, 15 Nov 2005 22:00:54 GMT
You could also setup the datasource in JNDI then set the
hibernate.connection.datasource property in your hibernate properties.

Example:

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="hibernateProperties">
            <props>
                  <prop
key="hibernate.connection.datasource">java:comp/env/jdbc/mydb</prop>
                  .
                  .
                  .
            </props>
      </property>
      .
      .
      .
</bean>

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


                                                                                         
                                             
                      William Moore                                                      
                                             
                      <williammoore@mac        To:       users@cocoon.apache.org      
                                                
                      .com>                    cc:                                    
                                                
                                               Subject:  Re: Connection Pooling for Spring
and Hibernate3                              
                      11/15/2005 04:47                                                   
                                             
                      PM                                                                 
                                             
                      Please respond to                                                  
                                             
                      users                                                              
                                             
                                                                                         
                                             




Johannes

On 15 Nov, 2005, at 8:17 pm, Johannes Textor wrote:

> William Moore schrieb:
>
>> Is it possible to use the Cocoon database connection pool inside an
>> application based on Cocoon, Spring and Hibernate?
>>
>> I have looked at CHS (http://www.cocoondev.org/main/117/43.html) and
>> CocoonAndHibernateTutorial
>> (http://wiki.apache.org/cocoon/CocoonAndHibernateTutorial), but the
>> former does not use the Cocoon connection pool and the latter does not
>> use Spring.
>>
>> In my attempts I have found that Spring seems to create the DataSource
>> and SessionFactory objects defined in it's applicationContext.xml file
>> very early in the start-up process and outside the Cocoon framework.
>> This means the classes cannot operate as Cocoon Components and
>> consequently they cannot access the Cocoon connection pools.
>>
>> Is this correct or am I missing something obvious? I'm fairly new to
>> programming at this level.
>
> This is aboslutely correct. When using Spring, you should not use the
> Cocoon connection pool since that would mean a dependancy on the view
> layer (Cocoon in that case) for data persistency. The tutorial is meant
> to get you started quickly and with no requirements besides cocoon and
> hibernate, so it uses the Cocoon connection pool, but that is not the
> end of the story.

OK, I interpret that as meaning I should use
org.apache.commons.dbcp.BasicDataSource to build a DataSource either by
defining it inside Spring's applicationContext.xml file or by defining
it inside Tomcat. Is that correct? If it is, I'll probably use the
former as it does not tie me to Tomcat.

Thanks

William


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




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


Mime
View raw message