可能是驱动问题。
struts+hibenate+spring 这种架构干嘛用jboss

解决方案 »

  1.   

    我是楼主!谢谢各位!
    你们是说使用的sql server驱动么?
    但是同样的驱动我用struts+hibenate开发一直很好,也是使用同一个jboss。
    这两个工程唯一的不同就是增加了spring,但问题就出现了。
    这是我连接数据库的文件,也是spring配置文件。
    -----------------------------------------
      <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close" >
        <property name="driverClassName">
          <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
        </property>
        <property name="url">
          <value>jdbc:microsoft:sqlserver://localhost:1433;Database=Component;selectmethod=cursor</value>
        </property>
        <property name="username">
          <value>collin000</value>
        </property>
        <property name="password">
          <value>68765070</value>
        </property>
      </bean>  <bean id="sessionFactory"  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" destroy-method="close" > 
        <property name="dataSource">
          <ref local="dataSource"/>
        </property>
        <property name="mappingResources">
          <list>
            <value>com/powerapps/model/CompanyInfo.hbm.xml</value>
            <value>com/powerapps/model/DepartInfo.hbm.xml</value>
          </list>
        </property>
        <property name="hibernateProperties">
          <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
          </props>
        </property>
      </bean>    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> 
            <property name="sessionFactory"> 
                <ref bean="sessionFactory"/> 
            </property> 
        </bean>     <bean id="transactionManager" 
              class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
            <property name="sessionFactory"> 
                <ref bean="sessionFactory"/> 
            </property> 
        </bean> 







        <bean id="departService" 
              class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
            <property name="transactionManager"> 
                <ref bean="transactionManager"/> 
            </property> 
            <property name="target"> 
                <ref local="departServiceImpl"/>
            </property> 
            <property name="transactionAttributes"> 
                <props> 
                    <prop key="get*">PROPAGATION_SUPPORTS</prop>
             <prop key="*">PROPAGATION_REQUIRED</prop>
                </props> 
            </property>        
        </bean>  
         
        <bean id="departServiceImpl" class="com.powerapps.service.impl.baseinfo.DepartServiceImpl" >
         <property name="companyInfoDao"><ref local="companyInfoDao"/></property> 
         <property name="departInfoDao"><ref local="departInfoDao"/></property> 
    </bean>



        <bean id="companyService" 
              class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
            <property name="transactionManager"> 
                <ref bean="transactionManager"/> 
            </property> 
            <property name="target"> 
                <ref local="companyServiceImpl"/>
            </property> 
            <property name="transactionAttributes"> 
                <props> 
                    <prop key="get*">PROPAGATION_SUPPORTS</prop>
             <prop key="*">PROPAGATION_REQUIRED</prop>
                </props> 
            </property>        
        </bean>  
         
        <bean id="companyServiceImpl" class="com.powerapps.service.impl.baseinfo.CompanyServiceImpl" >
         <property name="companyInfoDao"><ref local="companyInfoDao"/></property> 
    </bean>






    <bean id="companyInfoDao" class="com.powerapps.dao.impl.CompanyInfoDao"> 
        <property name="hibernateTemplate"> 
                <ref bean="hibernateTemplate"/> 
            </property> 
    <property name="sessionFactory"> 
                <ref bean="sessionFactory"/> 
            </property> 
    </bean>

    <bean id="departInfoDao" class="com.powerapps.dao.impl.DepartInfoDao"> 
        <property name="hibernateTemplate"> 
                <ref bean="hibernateTemplate"/> 
            </property> 
    <property name="sessionFactory"> 
                <ref bean="sessionFactory"/> 
            </property> 
    </bean>

      <bean name="/departInfo" class="com.powerapps.action.DepartInfoAction" singleton="false">
      <property name="departService">
      <ref local="departService" />
      </property>
      <property name="companyService">
      <ref local="companyService" />
      </property>
      </bean>