Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3791626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:29:54+00:00 2026-05-19T12:29:54+00:00

I’ve got a Vehicle entity, with a Vehicle DTO. I use OpenSessionInView with Stripes.

  • 0

I’ve got a Vehicle entity, with a Vehicle DTO.

I use OpenSessionInView with Stripes.

In my Stripes action bean, i need to generate a csv containing the data for about 50000 Vehicles.

Thus, as a Stripes developer told me to do, i write the file to the outputstream in the following method:

StreamingResolution() {...}.stream(HttpServletResponse)

I have a service that take some pagination information, load a part of the vehicles and transform them into DTO’s.

These dto’s are returned to the view and written to the csv.

The pagination system (500 items for each page) was made to avoid having a list of 50000 DTO and have some memory problems.

But it doesn’t work perfectly yet. With Jmap i saw that at the end of the csv process, there are more than 40000 vehicules loaded in heap space and not garbage collected.

With Yourkit profiler, it seems to me that these entities are still in the L1 cache of hibernate (referenced in StatefulPersistenceContext), and since i have OpenSessionInView, i guess the problem is that the conversation is a bit long and the cache need to be cleaned…

I just wonder how to do that in an elegant way since my dao methods loading vehicles are used by a lot of services that doesn’t necessary need a session clean/flush.

Someone know i could do? I guess i can make a method in the DAO/Service to clear the session but it’s not very elegant…

This is a pretty big project and i made a very simple description of it. Please don’t tell me to not use opensessioninview or something like that, it’s not my decision… 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:29:55+00:00Added an answer on May 19, 2026 at 12:29 pm

    It may not be elegant, but in cases like this evicting entities from the session is the only practical solution.

    For example, once you’ve finished writing an entity’s data to the output stream, call session.evict(entity) to remove it from the session cache. Alternatively, call this at the end of each “page”.

    The combination of the paging mechanism and the eviction should ensure you never have more than 500 entities in the cache at one time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.