Announcement Announcement Module
Collapse
No announcement yet.
Need help with OpenSessionInViewFilter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with OpenSessionInViewFilter

    I have read all the posts and blogs on this subject and I have implemented it to the best of my knowledge but it does not work. I still get the org.hibernate.LazyInitializationException.

    Here's my web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>

    <web-app>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/tess-servlet.xml
    </param-value>
    </context-param>

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    <servlet>
    <servlet-name>tess</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>tess</servlet-name>
    <url-pattern>*.htm</url-pattern>
    </servlet-mapping>

    <filter>
    <filter-name>hibernateFilter</filter-name>
    <filter-class>
    org.springframework.orm.hibernate3.support.OpenSes sionInViewFilter
    </filter-class>
    <init-param>
    <param-name>singleSession</param-name>
    <param-value>false</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>hibernateFilter</filter-name>
    <url-pattern>*.htm</url-pattern>
    </filter-mapping>

    <welcome-file-list>
    <welcome-file>
    index.jsp
    </welcome-file>
    </welcome-file-list>

    </web-app>

    Here's the snippet from my tess-servlet.xml

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName">
    <value>net.sourceforge.jtds.jdbc.Driver</value>
    </property>
    <property name="url">
    <value>jdbc:jtds:sqlserver://localhost/company</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value>password</value>
    </property>
    </bean>
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="mappingDirectoryLocations">
    <list>
    <value>classpath:/com/company/tess/objects</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.SQLS erverDialect</prop>
    </props>
    </property>
    <property name="dataSource">
    <ref bean="dataSource"/>
    </property>
    </bean>

    One thing I have noticed is that the log file shows all the hibernate mappings happening twice.

    Any ideas would be appreciated.
Working...
X