Results 1 to 2 of 2

Thread: OpenSessionInViewFilter - open connections

  1. #1
    Join Date
    Mar 2005
    Posts
    3

    Default OpenSessionInViewFilter - open connections

    Hi Folks -
    I'm in the middle of upgrading our apps to Spring 1.2 and Hibernate 3.0.3. I thought I would take another stab at implementing OpenSessionInViewFilter since hibernate 3.0 uses lazy="true" by default everywhere...

    We are using:
    • * WebLogic 8.1 sp3
      * JTATransactionManager for spring managed transactions
      * some CMT EJBs with required transactions



    When I specify singleSession = false for the filter, I get proper behavior, but the deferred session close means that ALL sessions remain open until the filter completes - which means 1 request may use many connections.

    What I need, is for some non-transactional session to be used to load read-only/lazy objects, and open separate sessions for transactional object use.

    We cannot use the same session in multiple transactions (or after a transaction commits/rollsback) due to JTA/WebLogic constraints.

    Is the only alternative to use a single JTA tx per http request?

    thanks
    tyson

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    AFAIK, unless you mark your methods as transactional, no transaction will made even inside a CMT environment but I may be mistaken - place logging on Hibernate Transaction.
    If you need specific behavior you can extends the OpenSessionFilterInView and to customize it to allow a better configuration that fits your needs.
    For example you can parse the request and depending on the path create transactional or non-trasactional sessions.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Similar Threads

  1. Replies: 7
    Last Post: Sep 13th, 2005, 01:45 AM
  2. problem persisting with manager
    By scottb022563 in forum Data
    Replies: 0
    Last Post: Jul 18th, 2005, 05:45 AM
  3. Replies: 3
    Last Post: May 16th, 2005, 07:04 AM
  4. Unclosed Hibernate Connection
    By jvargas in forum Data
    Replies: 4
    Last Post: Mar 28th, 2005, 01:24 PM
  5. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM

Posting Permissions

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