-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to join subclass of the association class
PostPosted: Fri Nov 21, 2008 9:41 am 
Newbie

Joined: Thu Nov 20, 2008 11:42 am
Posts: 4
Hi there,
I have Cat, Dog, Tiger entities, and Animal entity as base class. Mapping to this is "table per subclass". Also, Person class has many Animals, using "bag" xml-element (bidirectional relation).

Each Cat and Tiger has property as ClawSize. But this property (assuming it is not significant to Dog nor Animal) will NOT belong to Animal nor Dog.

I want to fetch all people (Persons :) ) that conform at lease one of these criteria:

Any cat having ClawSize > 10 units, or any tiger having ClawSize > 15 units.

All I want to query it at one round trip, i.e. to generate one sql.

And also I want to prefetch (eager load), all animals of each person, i.e. not only those matching the criteria (but it's not that important).

Can someone provide any help, please. Using ICriteria would be much better, but I couldn't do by it. So I tried with HQL, and no success. In native sql, I can, but I dont think it would be best practice using this in NHibernate (or Hibernate).


NHibernate build version: 1.2.1.4000.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.