Results 1 to 3 of 3

Thread: Error Bean property hibernateTemplate

  1. #1

    Unhappy Error Bean property hibernateTemplate

    Bean property 'hibernateTemplate' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?

  2. #2
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    You need to give *so* much more information

    What bean are you trying to set the hibernateTemplate on?

    Can you post your config and your code please.

  3. #3

    Unhappy file configuration

    Application-context.xml

    <bean id="PropertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations"><value>classpath:org/aqua/AQResource/hibernate.properties</value></property>
    </bean>

    <!-- DataSource Definition -->
    <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" >
    <property name="driverClassName"><value>${hibernate.connecti on.driver_class}</value></property>
    <property name="url"><value>${hibernate.connection.url}</value></property>
    <property name="username"><value>${hibernate.connection.user name}</value></property>
    <property name="password"><value>${hibernate.connection.pass word}</value></property>
    </bean>

    <!-- Choose the dialect that matches your "dataSource" definition -->
    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="configLocation"><value>classpath:org/aqua/AQCfg/hibernate_ioo.cfg.xml</value></property>
    <property name="hibernateProperties"><ref local="hibernateProperties"></ref></property>
    <property name="dataSource"><ref local="myDataSource"/></property>
    </bean>

    <!-- Test connection -->
    <bean id="testDs" class="org.aqua.AQUtils.TestDs" init-method="init">
    <property name="dataSource"><ref local="myDataSource"/></property>
    </bean>

    <bean id="hibernateProperties" class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
    <property name="properties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
    <prop key="hibernate.cglib.use_reflection_optimizer">${h ibernate.cglib.use_reflection_optimizer}</prop>
    <prop key="hibernate.use_outer_join">${hibernate.use_out er_join}</prop>
    </props>
    </property>
    <property name="location" value="classpath:org/aqua/AQResource/hibernate.properties"/>
    </bean>

    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <!--
    <bean id="myTransactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory"><ref local="mySessionFactory"/></property>
    </bean>
    -->
    <!-- Hibernate Template Defintion -->
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <property name="sessionFactory"><ref bean="mySessionFactory"/></property>
    <property name="cacheQueries"><value>true</value></property>
    </bean>

    <!--
    <bean id="hibernateDaoSupport" class="org.springframework.orm.hibernate3.support. HibernateDaoSupport" abstract="true">
    <property name="sessionFactory"><ref bean="mySessionFactory"/></property>
    </bean>
    -->

    <!-- ========================= Start of DAO DEFINITIONS ========================= -->
    <!-- DAO object: Hibernate implementation -->
    <bean id="userDao" class="org.aqua.AQDao.Implement.UserDaoImpl">
    <property name="hibernateTemplate"><ref local="hibernateTemplate"/></property>
    </bean>
    <bean id="solicitudDao" class="org.aqua.AQDao.Implement.SolicitudDaoImpl">
    <property name="hibernateTemplate"><ref local="hibernateTemplate"/></property>
    </bean>

    <!-- ========================= Start of SERVICE DEFINITIONS ========================= -->
    <bean id="userService" class="org.aqua.AQService.Implement.UserServiceImp l">
    <!-- <property name="transactionManager"><ref local="myTransactionManager"/></property> -->
    <property name="userDao"><ref local="userDao"/></property>
    </bean>
    <bean id="solicitudService" class="org.aqua.AQService.Implement.SolicitudServi ceImpl">
    <!-- <property name="transactionManager"><ref local="myTransactionManager"/></property> -->
    <property name="solicitudDao"><ref local="solicitudDao"/></property>
    </bean>
    <!-- Add more services here -->
    </beans>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •