wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes restrict queries in association while fetching data.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "restrict queries in association while fetching data.... " Watch "restrict queries in association while fetching data.... " New topic
Author

restrict queries in association while fetching data....

Bhavin Sanghani
Ranch Hand

Joined: Dec 17, 2003
Posts: 67
Hi

I want to restrict few queries while fetching the data. I have kept lazy="false" in my code with fetch="subselect" and "join" as appropriate. Now, I want to fetch objects upto one level and at second level except one association i want to discard everything in query. e.g.

In following mapping strucutre, I want to load all QuestionsAnswer with Question & Answer objects only and not Feature which has association in Answer:




Any idea how can I do this?

Thanks,
Bhavin
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You'll need to map the association to feature as lazy and not eagerly fetch it in your HQL/Criteria.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: restrict queries in association while fetching data....
 
Similar Threads
hibernate inheritence problem
Hibernate - Object Graph using outer join
Auto Generator in composite key
JPA Mapping Exception
hibernate question - left outer join (best practices)