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

  • OpenSessionInViewFilter - Problems

    Hi,

    I have the classic problem with Lazy Initialization Error. I have encountered this error in one of my previous projects, and after investigating the boards, I found that the solution was to include Spring's OpenSessionInViewFilter. So, I tried the same solution on my current project. The only relevant difference that I can see between the two projects, is that the one with the problems use many-to-many associations in hibernate. Everything else is set the same. I keep receiving this error when i try to insert into my database.

    Code:
    javax.faces.FacesException: #{AJAX_CREATE_PRODUCT.processAjaxRequest}: javax.faces.el.EvaluationException: /widgets/configurationTabPanel.xhtml @55,253 action="#{AJAX_CREATE_PRODUCT.processAjaxRequest}": org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
    	com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
    	javax.faces.component.UICommand.broadcast(UICommand.java:332)
    	org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
    	org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
    	org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
    	org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
    	com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
    	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
    	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
    	javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
    	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
    	org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
    	org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)

  • #2
    That's not a lazy initialization error - it looks like you have something wrong with your transaction demarcation settings. Can you post the relevant portions of your Spring config, or describe what you're doing for transaction management?

    Comment


    • #3
      That was quick...

      I found the solution using this thread..

      http://forum.springframework.org/showthread.php?t=12414

      Comment

      Working...
      X