ssh框架里面事务配置一个service能配置多个DAO吗? 30
<!--配置sessionFactory--><beanid="sessionFactory"class="org.springframework.orm.hiberna...
<!-- 配置sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="javax.persistence.validation.mode">none</prop>
</props>
</property>
<property name="packagesToScan" value="ssh.po"></property>
</bean>
<!-- 配置前台登录 -->
<bean id="qUserDahService" class="ssh.service.impl.QuserDahServiceImpl">
<property name="qUserDahDao">
<ref bean="qUserDahDao" />
</property>
</bean>
<bean id="qUserDahDao" class="ssh.dao.impl.QuserDahDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="qUserDao" class="ssh.dao.impl.QuserDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
这样配置,第二个Dao不能用了,怎样让两个都配置 展开
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="javax.persistence.validation.mode">none</prop>
</props>
</property>
<property name="packagesToScan" value="ssh.po"></property>
</bean>
<!-- 配置前台登录 -->
<bean id="qUserDahService" class="ssh.service.impl.QuserDahServiceImpl">
<property name="qUserDahDao">
<ref bean="qUserDahDao" />
</property>
</bean>
<bean id="qUserDahDao" class="ssh.dao.impl.QuserDahDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="qUserDao" class="ssh.dao.impl.QuserDaoImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
这样配置,第二个Dao不能用了,怎样让两个都配置 展开
2个回答
展开全部
用注解方式或者改成
<bean id="qUserDahService" class="ssh.service.impl.QuserDahServiceImpl">
<property name="qUserDahDao" ref ="qUserDahDao" />
<property name="qUserDao" ref="qUserDao" />
</bean>
<bean id="qUserDahService" class="ssh.service.impl.QuserDahServiceImpl">
<property name="qUserDahDao" ref ="qUserDahDao" />
<property name="qUserDao" ref="qUserDao" />
</bean>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询