当前位置: 代码迷 >> Java Web开发 >> 关于SSH的配置有关问题
  详细解决方案

关于SSH的配置有关问题

热度:2496   发布时间:2013-02-25 21:13:36.0
关于SSH的配置问题
<?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:aop="http://www.springframework.org/schema/aop"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans 
  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://www.springframework.org/schema/aop 
  http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
  http://www.springframework.org/schema/tx 
  http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<!-- 配置数据源 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/schooldb">
</property>
<property name="username" value="root"></property>
<property name="password" value=""/>
</bean>
<!-- 配置SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<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="current_session_context_class">thread</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="connection.pool_size">10</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>order.hbm.xml</value>
<value>OrderLineItem.xml</value>
</list>
</property>
</bean>
<!-- 配置TransactionManager -->
</beans>
这个是我的applicationContext.xml的配置

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-Mapping PUBLIC
  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-Mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.hxex.bo.Order" table="orders" >
<id unsaved-value="0" name="id" type="java.lang.Integer" column="Order_ID">
<generator class="native"/>
</id>
<set inverse="true" cascade="save-update" lazy="true" name="orderlineitems">
<key column="ORDER_ID"/>
<one-to-many class="com.hxex.bo.OrderLineItem"/>
</set>
<property name="total" column="Total" unique="false" not-null="false" type="double"/>
<property name="userName" column="UserName" unique="false" not-null="true" type="String"/>
</class>
</hibernate-mapping>


<?xml version="1.0" encoding="UTF-8"?>
  相关解决方案