hibernate多SessionFactory配置
<bean id="aDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${adriver}</value> </property> <property name="url"> <value>${aurl}</value> </property> <property name="username"> <value>${ausername}</value> </property> <property name="password"> <value>${apassword}</value> </property> </bean> <bean id="bDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${bdriver}</value> </property> <property name="url"> <value>${burl}</value> </property> <property name="username"> <value>${busername}</value> </property> <property name="password"> <value>${bpassword}</value> </property> </bean> <!-- Hibernate SessionFactorys --> <bean id="aSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="aDataSource" /> </property> <property name="mappingResources"> <list> <value>.hbm.xml文件</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${ahibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="format_sql">true</prop> </props> </property> </bean> <bean id="bSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="bDataSource" /> </property> <property name="mappingResources"> <list> <value>.hbm.xml文件</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${bhibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="format_sql">true</prop> </props> </property> </bean>
热爱孤独生活
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步