环境:myeclipse8.0,tomcat6.0,struts2,hibernate3.2,spring2.5,jndi
spring配制文件:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"></property>
<property name="url"
value="jdbc:sqlserver://localhost:1433;DatabaseName=huaman"></property>
<property name="username" value="sa"></property>
<property name="password" value="sa"></property>
<property name="maxActive" value="100"></property>
<property name="maxIdle" value="30"></property>
<property name="maxWait" value="10000"></property>
<property name="defaultAutoCommit" value="false"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/huaman/entity/UserInfo.hbm.xml</value>
</list>
</property>
</bean>
<!-- TransactionManager --><!-- 注释1
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="transactionProxyFactoryBean" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="select*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="has*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="query*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
-->
<bean id="userBiz" class="com.huaman.biz.impl.UserBizImpl">
<property name="userDao" ref="userDao"></property>
</bean>
<bean id="loginAction" class="com.huaman.action.user.UserInfoAction"
scope="prototype">
<property name="userBiz" ref="userBiz"></property>
</bean>
<bean id="registerAction" class="com.huaman.action.user.UserRegisterAction"
scope="prototype">
<property name="userBiz" ref="userBiz"></property>
</bean>
DAO:方法名addUser;super.getHibernateTemplate().save(userInfo);
在网上找了很多,改了半天就是不行,hibernate.xml里也有:true 。hibernate插入语句也能出来,死活就是不写进数据库。