-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Spring OpenSessionInViewFilter web.xml mapping problem
PostPosted: Thu Aug 12, 2004 7:31 pm 
Newbie

Joined: Wed Nov 12, 2003 4:57 pm
Posts: 14
Location: New York City
I am having a minor issue integrating the Spring Framework's OpenSessionInViewFilter.

The following is the code I used inside web.xml to map the filter:

<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate.support.OpenSessionInViewFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>*.do</url-pattern>

<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>mySessionFactory</param-value>
</init-param>
</filter-mapping>


The problem is that the init-param sessionFactoryBeanName is being ignored and the application cannot find that session factory bean name.

In order to get around the problem, I renamed my spring sessionFactoryBean to be called "sessionFactory" instead of mySessionFactory" since that is the default name. This works fine. However, I am curious if anyone else has had this problem of not being able to specify a custom session factory bean name.

Thanks for your time,

Ethan Schreiber


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 14, 2004 9:24 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
According to the Servlet spec, you need to put the filter init-param inside the filter tag rather than the filter-mapping tag.

Code:
<filter>
  <filter-name>OpenSessionInViewFilter</filter-name>
  <filter-class>org.springframework.orm.hibernate.support.OpenSessionInViewFilter</filter-class>
  <init-param>
    <param-name>sessionFactoryBeanName</param-name>
    <param-value>mySessionFactory</param-value>
  </init-param>
</filter>

<filter-mapping>
  <filter-name>OpenSessionInViewFilter</filter-name>
  <url-pattern>*.do</url-pattern>
</filter-mapping>


Juergen


Top
 Profile  
 
 Post subject: How stupid of me!
PostPosted: Sun Aug 15, 2004 8:06 am 
Newbie

Joined: Wed Nov 12, 2003 4:57 pm
Posts: 14
Location: New York City
Thank you for the response. Sorry to post a careless mistake to the forum.

And on a side note Juergen , thank you very much for all of your hard work on the Spring/Hibernate integration. The tools provided are very well thought out and incredibly useful. You have saved me literally weeks of work and make my project much more manageable.

Ethan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.