Siema,
mam taki problem ze zdefiniowaniem bean'ow, ktore wstrzykuja sessionfactory do klasy dao. Moze dobrze tego nie ogarniam, dlatego prosze o rozjasnienie.
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://localhost/ars"/>
<property name="user" value="root"/>
<property name="password" value=""/>
<property name="initialPoolSize" value="1" />
<property name="maxPoolSize" value="1" />
<property name="acquireIncrement" value="1" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="myDataSource" />
<property name="annotatedClasses">
<list>
<value>com.example.ars.model.ResidentModel</value>
<value>com.example.ars.model.StreetModel</value>
<value>com.example.ars.model.TownModel</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="connection.pool_size">1</prop>
<prop key="current_session_context_class">thread</prop>
<prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hbm2ddl.auto">validate</prop>
</props>
</property>
</bean>
<bean id="residentDao" class="com.example.ars.dao.ResidentDao">
<constructor-arg ref="sessionFactory"/>
</bean>
<bean id="streetDao" class="com.example.ars.dao.StreetDao">
<constructor-arg ref="sessionFactory"/>
</bean>
<bean id="townDao" class="com.example.ars.dao.TownDao">
<constructor-arg ref="sessionFactory"/>
</bean>
</beans>
W jaki sposób powinienem to zrobić, skoro ten działa tylko w przypadku, jeśli mam jeden bean wstrzykiwany do dao (a nie 3 tak jak teraz).
Nie ma zadnych bledow, przy deployowaniu wisi na komunikacie
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource@fde7fb[ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> fde7fb, idleConnectionTestPeriod -> -1, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://localhost/ars, loginTimeout -> 0, maxIdleTime -> 0, maxPoolSize -> 1, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=, password=}, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ]
az przekroczy timeout.
dodanie znacznika <code class="xml"> + zamiana znaków tablatora na spacje - fp