一转眼来北京已经将近两个月了,工作也一个多月了,不过还是有点不习惯 ,主管说我现在主要是学习呀,所以还没有加班的,听同事说公司加班有时得加到凌晨的,不知道我能不能承受的住,不过我想我是可以的。这两天看了spring 整合struts+hibernate居然成功了,我非常高兴,并也十分感谢视频提供者。我用的是oracle库 相对别的库复杂一些,下面是applicationContext.xml文件:
<beans></beans>
<bean class="com.sino.action.InsertAction" name="/insert"></bean>
<bean class="com.sino.action.InsertAction" name="/insert"></bean>
<beans></beans>
/**1<beans></beans>
2 <bean class="com.sino.action.InsertAction" name="/insert"></bean>3 abstract="false" singleton="true" lazy-init="default"
4autowire="default" dependency-check="default">
5
<property name="dao">
6 <ref local="SuserDAO"></ref>
7 </property>
<property name="su">
<ref local="Suser"></ref>
</property>
<bean id="dataSource"></bean> class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value></value>oracle.jdbc.driver.OracleDriver
</property>
<property name="url">
<value></value>jdbc:oracle:thin:@192.168.1.103:1521:ks
</property>
<property name="username">
<value></value>sfksuser
</property>
<property name="password">
<value></value>aaaaaa
</property>
<bean id="sessionFactory"></bean> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"></ref>
</property>
<property name="hibernateProperties">
<props></props>
<prop key="hibernate.dialect"></prop>
org.hibernate.dialect.Oracle9Dialect
<prop key="hibernate.show_sql"></prop>
true
</property>
<property name="mappingResources">
<list></list>
<value></value>com/sino/pojo/Mz.hbm.xml
<value></value>com/sino/pojo/Suser.hbm.xml
</property>
<bean class="com.sino.pojo.MzDAO" id="MzDAO"></bean>
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
<bean class="com.sino.pojo.SuserDAO" id="SuserDAO"></bean>
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
<bean class="com.sino.pojo.Suser" id="Suser" abstract="false"></bean> singleton="true" lazy-init="default" autowire="default"
dependency-check="default">
**/
<bean class="com.sino.action.InsertAction" name="/insert"></bean>
还有库映射文件:Suser.hbm.xml
只有用户名,密码的库。
建序列 seq_id
1 create sequence seq_id
2 minvalue 1
3 start with 1
4 increment by 1
5 cache 20;
文件
<!---->
<!---->"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!---->
<hibernate-mapping></hibernate-mapping>
<class name="com.sino.pojo.Suser" table="SUSER" schema="SFKSUSER"></class>
<id name="userid" type="string"></id>
<column></column>
<generator class="&lt;font color="></generator>sequence
<property name="username" type="string">
<column></column>
</property>
<property name="password" type="string">
<column></column>
</property>
" >
seq_id
<a href="http://www.netyi.net/in.asp?id=huyuhong001"> http://www.netyi.net/in.asp?id=huyuhong001<a>