Results 1 to 5 of 5

Thread: Fetching children entities IDS (rather than whole entities)when fetching collections?

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Default Fetching children entities IDS (rather than whole entities)when fetching collections?

    Hello all !

    Basically my problem is the following :
    We have some objects for which we use the second level cache.
    When we retrieve a collection of these objects, what hibernate should do is fetch ids, and then get elements from the cache.
    Instead, it fetches all objects at once.

    This is quite a problem if these objects are big and many entities have collections of them...

    Seems that what we would need would be a new fetch mode (maybe lazy mode) where we would first get ids and then get the entities one by one.

    Anyone knows how to do this, or maybe a JIRA about the issue ?

    Thanks in advance

    Yannick

  2. #2
    Join Date
    Jun 2009
    Posts
    11

    Default

    You can do that using an OpenSessionInViewFilter.

  3. #3
    Join Date
    Aug 2009
    Posts
    3

    Default

    Mmh, well, I don't see a link. Think you read too fast

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    You have to be careful when dealing with potentially large sets of data. OSIV is useful but can help cause problems if not used properly. You might want to have a look at the various options hibernate has for pagination and batched fetching, they might be of use.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  5. #5
    Join Date
    Aug 2009
    Posts
    3

    Default

    Well, maybe I was unclear in my post, but again I don't think OSIV has anything to do with it.

Posting Permissions

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