Results 1 to 3 of 3

Thread: Keeping Session live

  1. #1

    Default Keeping Session live

    Is there any way to keep Hibernate session live after the method call?
    I am trying to implement Pagination using Gavin King's Page class.

    But it uses scrollable resultsets and as soon as my method exists, I think the session is getting killed.

    Any hints, pointers will be appreciated

    Regards,
    Vaibhav

  2. #2

    Default Re: Keeping Session live

    Quote Originally Posted by vaibhavpuranik
    Is there any way to keep Hibernate session live after the method call?
    I am trying to implement Pagination using Gavin King's Page class.

    But it uses scrollable resultsets and as soon as my method exists, I think the session is getting killed.

    Any hints, pointers will be appreciated

    Regards,
    Vaibhav
    it depends, in which layer you want to keep sessions open:
    1) web layer - try OpenSessionInViewFilter or interceptor.
    2) business layer - wrap you method into transaction.

    see more in this topic, look for lazyinitexception

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

    Default

    scrollable resultsets
    Besides keeping the session alive you can use DetachedCriteria to keep the result between different request (just make sure you store it somewhere).
    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. OpenSessionInView and portlet support
    By garpinc2 in forum Web Flow
    Replies: 31
    Last Post: Apr 9th, 2010, 11:12 AM
  2. OpenSessionInView + CMT Session usage
    By alesj in forum Data
    Replies: 7
    Last Post: Aug 16th, 2005, 02:32 AM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Replies: 1
    Last Post: Mar 12th, 2005, 04:33 AM
  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
  •