Results 1 to 3 of 3

Thread: OpenSessionInViewFilter - Problems

  1. #1

    Default 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. #2
    Join Date
    Sep 2004
    Location
    Manchester, NH
    Posts
    1,236

    Default

    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?
    Peter Mularien | Blog
    Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
    SCJP 5, Oracle DBA
    Any postings are my own opinion, and should not be attributed to my employer or clients.


  3. #3

    Default

    That was quick...

    I found the solution using this thread..

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

Posting Permissions

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