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

  • Home
  • SEARCH
  • 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 619561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:40:08+00:00 2026-05-13T18:40:08+00:00

so, i am really clutching at straws for ideas here. (also note: this is

  • 0

so, i am really clutching at straws for ideas here. (also note: this is an intermittent problem)

i have a ‘parent’ object with a collection of ‘child’ objects:

<parent stuff>
…
<set name=”children” inverse=”true” order-by=”child_id”>
<cache usage=”read-write”/>
<key column=”parent_id”/>
<one-to-many class=”ChildClass”/>
</set>
…
</parent>

<child stuff>
…
<many-to-one name=”parent”
column=”parent_id”
insert=”true”
update=”true”
not-null=”true”
class=”ParentClass”
index=”idx_child_parent”/>
…
</child>

if i run a query that is like:
“select children from ChildClass child ” +
“where child.parent = :parent”;
it finds all the children. perfect.

however, if i search for the parent object (and find it), hibernate goes through and creates my ParentClass, but only populates ONE (the first) child of children. i actually debugged into the hibernate code and found that infact the call to setChildren() on ParentClass was only being sent a 1 element collection – when i know there are more from the first query.

so, i am using EHCache, and clearing it does no good: calling CacheManager.getInstance().clearAll();

restarting my application DOES work. only for it to break shortly afterwards on a seemingly random instance of a parent.

there isnt anything (that i know of) that is happening to directly cause this. does anyone know of a hibernate bug that would cause this, or an EHCache bug. am i calling clear properly on my cache?

any pointers would be good.

i am using hibernate 3.2.6, and the same problem is happening on mysql and postgres.

edit: i should also add that this collection with only 1 element is in a sort of ‘never existed’ state. ie. there was never a transaction that resulted in only 1 child element

  • 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-13T18:40:08+00:00Added an answer on May 13, 2026 at 6:40 pm

    It turns out that at one point we are doing a “join fetch” when getting a Review. A join fetch means that, for the collection of children, only the children that match my where clause are returned. So say I have 3 children > 10 and 1 child < 10, if my where clause says child < 10, it returns the parent object, with a set of children containing ONLY that one child. Thats fine, thats what “join fetch” is for.

    The things thats wrong is that Ehcache doesnt know that this parent object is “incomplete”, and so it stores this incomplete value in the cache. Next time i want the “full” parent object, i dont get it, i get the incomplete one, and Hibernate doesnt tell me (doesnt know) otherwise.

    edit: note, it was just by chance that every time it happened, it was only 1 child element. it possible for there to be more.

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

Sidebar

Related Questions

I have something here that is really catching me off guard. I have an
Ok, I have just run into something that is really catching me off-guard. I
I have an incredibly frustrating problem cleaning up my site at the moment. On
Really hope someone can point me in the right direction as I have no
Really simple question - how do I do a search to find all records
Really stuck on trying to write code to unzip a file or directory on
Really my question has more to do with the server-side scrubbing of html that's
I really feel that I should learn Lisp and there are plenty of good
I really like DevX components, but they are pretty expensive, maybe anyone knows free
I really enjoyed Jeff's post on Spartan Programming . I agree that code like

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.