Announcement Announcement Module
Collapse
No announcement yet.
integration problem with hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • integration problem with hibernate

    Hello everyone. I am trying integration hibernate to a spring app, i have readed in internet that you nead to replace the hibernate configuration file by a bean representing the sessionfactory. I tried to do so but i have a 503 error page everytime. Here is the applicationContext.xml:
    Code:
     
    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:aop="http://www.springframework.org/schema/aop"
             xmlns:tx="http://www.springframework.org/schema/tx"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/aop
               http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx
               http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
     
        <!-- the parent application context definition for the springapp application -->
     
        <bean id="productManager" class="springapp.service.SimpleProductManager">
            <property name="productDao" ref="productDao"/>
        </bean>
     
        <bean id="productDao" class="springapp.repository.JdbcProductDao">
            <property name="dataSource" ref="dataSource"/>
        </bean>
    <!--
        <bean id="productDao" class="springapp.repository.p2">
        </bean>
    -->
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="${jdbc.driverClassName}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
        </bean>
     
        <bean id="propertyConfigurer"
              class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:jdbc.properties</value>
                </list>
            </property>
        </bean>
     
        <bean id="transactionManager"
              class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource"/>
        </bean>
     
        <bean id="exampleSessionFactory"
           class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
         <property name="dataSource">
             <ref local="dataSource"/>
         </property>
         <property name="mappingLocations">
             <list>
                 <value>
                     classpath:Product.hbm.xml
                 </value>
             </list>
         </property>
     
        </bean>
     
    </beans>
    the error come from the bean exampleSessionFactory because evry time i remove it everything works fine but i cant use hibernate.
Working...
X