• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to retrieve the value from grand Child in Hibernate

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a table called Parent which has one to many relataion with another table CHILD. This CHILD table has one to one relation with GRANDCHILD. I have used generic names to make my problem more clear.

I have a set defined in child.hbm.xml to fetch grandchild

<set name="GrandChildren" inverse="false">
<key>
<column name="ID" precision="12" scale="0" />
<column name="ORD_ID" precision="12" scale="0" />
</key>
<one-to-many class="com.myapp.GrandChild" />
</set>

wheneven i do

Parent parents = getsession.CreateCriteria(Parent.class).add(Restriction.eq("id",ParentId)).uniqueResult();

Set<Child>childrenSet = parents.getChildren();

the children set is populated but the GrandChildren set that i have mapped in CHILD.hbm.xml as i mentioned above is not at all populated.

If i use the hibernate query that i will get in console in SQl Client i was able to see the records for that particular query.

Please help on this
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Veeresh , ru you still looking for this solution ? If you have please post it

Regards,
MAhesh

Veeresh Hosur wrote:I have a table called Parent which has one to many relataion with another table CHILD. This CHILD table has one to one relation with GRANDCHILD. I have used generic names to make my problem more clear.

I have a set defined in child.hbm.xml to fetch grandchild

<set name="GrandChildren" inverse="false">
<key>
<column name="ID" precision="12" scale="0" />
<column name="ORD_ID" precision="12" scale="0" />
</key>
<one-to-many class="com.myapp.GrandChild" />
</set>

wheneven i do

Parent parents = getsession.CreateCriteria(Parent.class).add(Restriction.eq("id",ParentId)).uniqueResult();

Set<Child>childrenSet = parents.getChildren();

the children set is populated but the GrandChildren set that i have mapped in CHILD.hbm.xml as i mentioned above is not at all populated.

If i use the hibernate query that i will get in console in SQl Client i was able to see the records for that particular query.

Please help on this

 
reply
    Bookmark Topic Watch Topic
  • New Topic