Results 1 to 8 of 8

Thread: How clear session on commit?

  1. #1
    Join Date
    May 2007
    Posts
    7

    Default How clear session on commit?

    Hi,

    I searched on many forums, but I don't find it.

    I manage a lots of data with Spring, every 200 data I commit (with transaction). But an Out Of Memory happens, I think it's causes by first level cache which are not cleared. How can I force clear session on commit ?

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Which OR-mapper do you use? If it is Hibernate, then have a look ak Session.evict and Session.clear.

    Regards,
    Andreas

  3. #3
    Join Date
    May 2007
    Posts
    7

    Default

    I don't explicitly use evict or clear on the session. When transaction ended, I want a clear is call in the session and clear the first level cache.

  4. #4
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Quote Originally Posted by wizmerhill View Post
    I don't explicitly use evict or clear on the session. When transaction ended, I want a clear is call in the session and clear the first level cache.
    The session is the first-level cache. And if you want to clear the session then you have to call the clear-method. At least I am not aware of a possibility to clear sessions implicitly.

  5. #5
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Quote Originally Posted by Ranie View Post
    what is evict ?????
    http://www.hibernate.org/hib_docs/v3...-basics-issues

  6. #6
    Join Date
    May 2007
    Posts
    7

    Default

    I want when commit occurs then session is clear. Is it the default behavior or a property exists ?

  7. #7
    Join Date
    May 2007
    Posts
    7

    Default Between two transactions first level cache is clear ?

    Question : between two transactions, is first level cache clear ?

  8. #8
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    No... Not if you clear it yourself... You need to call session.clear() and/or session.evict to make that happen.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

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