SSH框架整合

2021-08-06 01:20:47 字數 1524 閱讀 9870

/記事本手打**,正確率略低/

1.匯入jar包

name="cn.com.product" table="product">

name="pid" column="pid">

class="native">

id>

name="pname" column="pname">

property>

name="page" column="page">

property>

class>

.新建乙個jdbc.properties的檔案,連線資料庫

jdbc.driverclass=com

.mysql

.jdbc

.driver

jdbc.url=jdbc:mysql://localhost:3306/ssh

jdbc.username=root

jdbc.password=123

.配置連線池

class="....combopooleddatasource">

name="driverclass" value="$"/>

name="jdbcurl" value="$"/>

name="user" value="$"/>

name="password" value="$"/>

.配置hibernate相關屬性

id="sessionfactory"

class="........localhibernatesessionfactory...">

name="datasource"

ref="datasource">

property>

name="hibernateproperties">

key="hibernate.dialect">

org.hibernate.dialect.mysqldialect

prop>

key="hibernate.show_sql">trueprop>

true

props>

key="hibernate.format_sql">

true

prop>

key="hibernate.hbm2ddl.auto">uodate

prop>

property>

cn.com.product.hbm.xmlvalue>

list>

list>

property>

bean>

5.配置事務管理器

class=".......hibernatetransactionmanager">

name="sessionfactory"

ref="sessionfactory">property>

6.開啟註解事務

7.在業務邏輯層@transactional

SSH框架整合

首先將 spring 加入到web容器在 web.xml 中加入 context param param name contextconfiglocation param name 說明 為了管理方便設定了多個 spring 的配置檔案 context param 然後加入 spring liste...

SSH框架整合

版本 struts 2.3.30,spring framework 3.2.10.release,hibernate distribution 3.6.0.final 一 引入相關jar檔案 二 struts.xml配置 apache software foundation dtd struts c...

SSH框架整合

用的是 myeclipse7.5,spring2.5,hibernate3.2,struts2.0 第一步 新增spring 能力 至少要匯入四個spring 庫 1 spring 2.5 core libraries 2 spring 2.5 persistence core libraries ...