MyException - 我的异常网
当前位置: 我的异常网 » J2EE » The method getHibernateTemplate() is undefined f

The method getHibernateTemplate() is undefined for the type XX,该如何解决

www.MyException.Cn,网友分享于:2013-05-02   浏览:255次
The method getHibernateTemplate() is undefined for the type XX
XML code

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd   
http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd   
http://www.springframework.org/schema/tx  
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- dataSource -->
    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url"
            value="jdbc:mysql://localhost:3306/qq?autoReconnect=true&amp;useUnicode=true&amp;characterEncodingutf-8" />
        <property name="username" value="root" />
        <property name="password" value="123456" />
    </bean>
    <!-- sessionFactory -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
        <property name="mappingResources">
            <list>
                <value>com/entity/A.hbm.xml</value>
                <value>com/entity/B.hbm.xml</value>
                <value>com/entity/C.hbm.xml</value>
            </list>
        </property>
        <property name="packagesToScan">
            <list>
                <value>com.entity</value><!-- 扫描实体类,也就是平时所说的model -->
            </list>
        </property>
    </bean>

<bean
        class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    <context:component-scan base-package="com.entity" /> <!-- 自动扫描所有注解该路径,NIBIE -->
    <!-- transaction -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <!-- implements -->
    <bean id="ADAO" class="com.dao.ADAO">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>

    <bean id="CDAO" class="com.dao.CDAO">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <bean id="BDAO" class="com.dao.BDAO">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <bean id="DServer" class="com.server.DServer">
        <property name="dao">
            <ref bean="BDAO" />
        </property>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" />
    <tx:annotation-driven mode="aspectj" />


 
各类解决方案>>热门搜索
软件开发程序错误异常Exception Copyright © 2009-2014 MyException 版权所有