Wojtek Baczyński wrote:Can anyone help me with simple crap?
I have many-to-one relation, Objects (parent) with really huge list of childs. Now when i do select of one particular child, hibernate is selecting also a parent. And becouse parent have many childrens, i get also many childrens.
But i want only this one child without a parent and others. What to do? Sure I can ingore other that but when list have 1000+ elements that is huge waste.
This is actually a common design problem that is a performance killer. In select cases a child object does need to have a reference to its parent object. However, in the majority of cases there is not a *real* need for a child object to have a reference to the parent object. Circilar references between classes can also set you up for an endless loop. I would suggest taking a step back from your code, reviewing your design, and ask yourself if the child object really does needs a reference to the parent object.