cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <...@apache.org>
Subject Re: Questions on CHS (Cocoon, Hibernate, Spring) petstore project
Date Mon, 11 Apr 2005 11:56:09 GMT
Il giorno 11/apr/05, alle 10:40, Jonny Pony ha scritto:

> I want to replace the HSQL with my MySQL database. What must I exactly 
> change in the "applicationContext.xml" to do that.
> Is this part still neccessary for my needs or does this only start and 
> stop the hsql-database?
>
> <bean id="hsqlServer" 
> class="org.apache.cocoon.petstore.database.HsqlServer" 
> init-method="start" destroy-method="stop"></bean>

You can remove this, as it is needed only to start the embedded HSQL 
server.

> Nr.2:
> I want to use the proxool connection-pooling. So is this part (in the 
> "applicationContext.xml") still neccessary for my needs?:
>
> <bean id="myDataSource" 
> class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" 
> depends-on="hsqlServer">
> 	<property name="driverClassName">
> 		<value>com.mysql.jdbc.Driver</value>
> 	...
> 	<property name="password">
> 		<value/>
> 	</property>
> </bean>

If Proxool implements java.sql.DataSource, you can simply change the 
name of the implementing class. Also, remove depends-on="hsqlServer".

>
> Or can I totally exchange it with something like this?:
>
> <bean id="sessionFactory" 
> class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
> 		....
> 	<property name="hibernateProperties">
> 		<props>
> 			<prop 
> key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
> 			...
> 			<prop key="hibernate.c3po.min_size">5</prop>
> 			...
> 			<prop 
> key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
> 		</props>
> 	</property>
> 	<property name="dataSource">
> 		<ref bean="myDataSource"/>
> 	</property>
> </bean>

Don't. Using Spring, you should define the (possibly pooled) datasource 
as its own bean, and refer to it in the sessionFactory bean definition. 
Spring will instantiate and wire them up in the correct order.

> And do I need something like the "myDataSource"-bean for my approach 
> then?

Yes.
>
> I couldn't find the mapping-files, like Account.hbm.xml,etc? Are there 
> any? Or better: Is there a database-model for the petstore in 
> generell?
> In UML, mapping-files or whatever?

The mapping files are automatically generated by the build.xml script, 
using XDoclet. Look for @hibernate tags in comments. Try running "ant 
genmappings".

>
> Is there some generell documentation for this chs-project?

Nothing besides what you can read on the website.

	Ugo

-- 
Ugo Cei
Tech Blog: http://agylen.com/
Source.zone: http://sourcezone.info/
Wine & Food Blog: http://www.divinocibo.it/

Mime
View raw message