• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fetch value from many-to-one mapping structure

 
Bhavin Sanghani
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have used many-to-one mapping structure.

ObjectA
|
|--- Object B1
| |
| |--- Object C11
| |--- Object C12
|--- Object B2
| |--- Object C21
| |--- Object C22


How can I fetch property value from Object C<numeric value> without using Iterator and going through many loops. Does Hibernate support easier way to fetch values/objects in such types of structure?

Thanks,
Bhavin

[ September 10, 2008: Message edited by: Bhavin Sanghani ]
[ September 10, 2008: Message edited by: Bhavin Sanghani ]
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're returning a whole object graph, then really, all you can do is logic to loop through or iterate through your object.

Perhaps a better strategy is to have more focussed HQL, or a specific Criteria API Query that will bring back just the information you want, and not a superfluous object graph?

-Cameron McKenzie
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!