struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garner Shawn" <shawndgar...@gmail.com>
Subject RE: RE: [HELP][S2] spring configuration of hibernate
Date Thu, 07 Sep 2006 15:47:13 GMT
What is all this hibernate.c3p0 stuff and where can I find
documentation on what to use?
Where can I find the spring-hibernate3 examples at?
Last I knew the props were just suppose to be prefixed with "hibernate."

Thanks,
Shawn


---------- Forwarded message ----------
From: "David Friedman" <humble@ix.netcom.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Date: Thu, 7 Sep 2006 03:24:35 -0400
Subject: RE: [HELP][S2] spring configuration of hibernate
I do things a little differently in my spring 2.0 + hibernate3.2.0.cr2
config (and it sure looks like you are using a spring 2.0 release candidate
to get the destroy-method attribute).  Just note that my someDAO name of
class example.MyHibernateDAOImpl extends HibernateDAOSupport and implements
example.MyHibernateDAO like in the spring-hibernate3 examples.  Your config
goes a slightly different route.  And yes, I changed from MySQL to Derby
just last week.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

       <bean id="exampleDataSource"
               class="org.apache.commons.dbcp.BasicDataSource">
               <property name="driverClassName">
                       <value>org.apache.derby.jdbc.EmbeddedDriver</value>
               </property>
               <property name="url">
                       <value>jdbc:derby:springexample;create=true</value>
               </property>
       </bean>

       <!-- Database Property -->
       <bean id="exampleHibernateProperties"
               class="org.springframework.beans.factory.config.PropertiesFactoryBean">
               <property name="properties">
                       <props>
                               <prop key="hibernate.hbm2ddl.auto">update</prop>
                               <prop key="hibernate.dialect">
                                       org.hibernate.dialect.DerbyDialect
                               </prop>
                               <prop key="hibernate.query.substitutions">
                                       true 'T', false 'F'
                               </prop>
                               <prop key="connection.username">guess</prop>
                               <prop key="connection.password">again</prop>
                               <prop key="hibernate.show_sql">true</prop>
                               <prop key="hibernate.c3p0.minPoolSize">5</prop>
                               <prop key="hibernate.c3p0.maxPoolSize">20</prop>
                               <prop key="hibernate.c3p0.timeout">600</prop>
                               <prop
key="hibernate.c3p0.max_statement">50</prop>
                               <prop
key="hibernate.c3p0.testConnectionOnCheckout">
                                       true
                               </prop>
                               <prop
key="hibernate.current_session_context_class">
                                       jta
                               </prop>
                       </props>
               </property>
       </bean>

       <!-- Hibernate SessionFactory -->
       <bean id="exampleSessionFactory"
               class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFact
oryBean">
               <property name="dataSource">
                       <ref local="exampleDataSource" />
               </property>
               <property name="hibernateProperties">
                       <ref bean="exampleHibernateProperties" />
               </property>
               <!--  OR annotated classes . -->
               <property name="annotatedClasses">
                       <list>
                               <value>
                                       example.graph.Category
                               </value>
                               <value>example.MyHibernateObj</value>
                       </list>
               </property>
       </bean>

               <bean id="someDAO" class="example.MyHibernateDAOImpl">
               <property name="sessionFactory" ref="exampleSessionFactory" />
               </bean>
</beans>

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


Mime
View raw message