-->
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: Criteria API - Child A/Without B or Child B/Without A
PostPosted: Wed Sep 06, 2006 2:28 pm 
Regular
Regular

Joined: Fri Aug 18, 2006 2:40 pm
Posts: 51
Location: Metz, France
Hibernate version:3.1.1

Name and version of the database you are using: Oracle9

I have a class called Person

- a Person who has an Address have no ContactDetails
- a Person who has a ContactDetails (phone, email, etc..) have no Address

I want to fetch the people who have

an address.city = 'METZ'

OR

a contactDetails.email like '%hotmail.fr'

(city is a simple property of Address class)
(email is a simple property of ContactDetails class)

I know how to create Aliases for Address and ContactDetails.

As soon as I create an Alias for address I know longer see Person with no Address. As soon as I create an Alias for contactDetails I know longer see Person with no contactDetails.
Since I want both to be in the where clause my result set is always empty.
Heeellllppp :-(
Looks like : http://opensource.atlassian.com/project ... e/HHH-1137
But I am not sure. If it is, only solution seems to be HQL.


Subsidiary question: How to order my rows of Person by city or by email.
i.e. if there is no Address use order by email, and use order by city if there is no contactDetails:
http://forum.hibernate.org/viewtopic.php?t=964506

Thanks in advance.

edit: I partially solved my problem using Hibernate 3.1.2 and createAlias with joinType

_________________
Denis
Don't forget to rate ... thanks.


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.