Parent « Load « JPA Q&A





1. JoinTable (Parent/Child) to self always joins to join table when loading    stackoverflow.com

I have an entity that can have 0 or many children of the same entity. Also, an entity can have 0 or one parent of the same entity. Tables structure

Account (
 ...

2. Loading collection without loading the parent object    forum.hibernate.org

Hibernate does a nice job lazy loading data. However, there is one scenario I can't quite figure out how to make work without use of queries. Suppose a have a PARENT object that has a collection of CHILDREN (the scenario is purely artificial just to explain the idea). Suppose PK on the PARENT is just a single field type Long. CHILDREN ...

3. TransientObjectException error if parent is not lazy loaded    forum.hibernate.org

Newbie Joined: Thu Feb 11, 2010 7:54 am Posts: 5 Hi, I am relative newbie to hibernate. I am getting a org.hibernate.TransientObjectException error when I delete a child object "scenario" and then ask the parent for a list of scenarios. I am able to recover fine and subsequently fetch child "scenario" objects. It just the sequence "delete child" "fetch children" that ...

4. Many-to-one of a parent class not loading in Beta 6    forum.hibernate.org

When we load the child with a many-to-one and ther is a INVOICE -> SELLER_PARTNERSHIP The "SellerPartnership" is not loading and it is causing us problems. We are on Beta 6. Any ideas? Here is a quote from the user: "when I try to load invoice alone, It is loading sellerPartnershipImpl successfully. But ...

5. Can a query load only Child and no Parent    forum.hibernate.org

Hi, If i simply want to load only the Child object and no Parent object, how to do that? There are two class test(Parent) and testChild(Child). There is one to many relationship between test and testChild and many to one from testChild to test. If i simply want to load testChild without loading test(parent), is it possible? I dont want to ...

6. How to lazy load Parent/Child,lazy many-to-one does not work    forum.hibernate.org

I'm trying to filter out parts of a single-class recursive (Parent/Child) tree structure according to user's role. The complete tree is accessed ok usinga separate key field - bi-directional construction of the unfiltered tree works fine, in a single query. However, trying to filter out a subset of the nodes (and then manually evicting any orphans) does not work, because Hibernate ...

7. Loading grandchild loads child and parent    forum.hibernate.org

I have a parent-child-grandchild relationship (A-B-C). A can have many Bs and B can have many Cs. B and C have composite ids. B has (A_id, B_id) as PK and C has (A_id, B_id, C_id) as PK. (This is a legacy schema with natural business keys throughout). All ids are assigned. My problem is that when I load C using session.createQuery(..), ...

8. loading a collection without loading the parent    forum.hibernate.org

I have the following pieces of information in a parent-child association: * the parent class * the parent primary key * the child collection property name and I would like to load the child collection without loading the parent instance. Is this possible? For example: Code: class Parent { Long id; Set childCollection; Set otherCollection; ...

9. Can't load() children when loading parent    forum.hibernate.org

Beginner Joined: Thu Jul 21, 2005 10:28 am Posts: 21 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.5 Mapping documents: Code: ...





10. Selectting child OK.. but cant load parent. What's up?    forum.hibernate.org

Newbie Joined: Sun Oct 23, 2005 9:45 am Posts: 3 Location: Tinton Falls, NJ Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.x Mapping documents: There are two objects that I'm concerned with here for this topic. The person object is the "parent" object to lots of objects and is used everywhere in my schema. The account ...

11. Parent object loading    forum.hibernate.org

The default is for lazy initialization. The parent object is loaded when it's needed. If the parent object is already loaded (is in the Hibernate session), then it doesn't have to be loaded again, it's just put in the child object as you'd expect it to be. The ref docs explain all about lazy initialization.

12. Limiting the depth of a parent/child load request    forum.hibernate.org

Hello I have a problem, which I would appriciate some help with if anyone has it. I have a parent/child relationship. Since the depth can be up to 10 or even more sometimes I dont want to send all levels over to the client but instead use lazy loading when the user goes deeper in the tree. In the request from ...

13. Joined-sublcass - lazy load the parent - possible?    forum.hibernate.org

No. That would break object orientation: an object is made up of all its class' properties, and all its superclasses' properties. To load part of it would be loading part of an object.. so you'd be using property orientation. I think they call that COBOL. Looks like you want a bidirectional one-to-one instead. That can be lazily loaded. Or maybe you ...

14. load(Parent.class,id) does not load child class correctly    forum.hibernate.org

Parent parent1 = (Parent) session.load(Parent.class, id); System.err.println("object is : " + parent1); if (parent1 instanceof Child) { System.err.println("It is a Child!"); }