耶!!沙发楼主我支持你
-----------------
松自萧萧云自飘
风中独酌亦逍遥
抚却凡愁与尘念
琴韵未解恨已销

解决方案 »

  1.   

    楼上的兄弟,不要忽悠我...直接用hibernate测试,可以通过.问题出在spring的配置文件.有点迷糊..<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName">
    <value>com.mysql.jdbc.Driver</value>
    </property>
    <property name="url">
    <value>jdbc:mysql://127.0.0.1:3306/searchdate</value>
    </property>
    <property name="username">
    <value>root</value>
    </property>
    <property name="password">
    <value>root</value>
    </property>
    </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref local="dataSource" />
    </property> <property name="mappingResources">
    <list>
    <value>com/search/entity/Company.hbm.xml</value>
    </list>
    </property> <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean> <bean id="pageInfoDao" class="com.search.dao.PageInfoDao">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean> <bean id="findLinkProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="transactionManager" />
    </property> <property name="target">
    <ref local="pageInfoDao" />
    </property> <property name="proxyTargetClass">
    <value>true</value>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    </props>
    </property>
    </bean></beans>