-->
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.  [ 2 posts ] 
Author Message
 Post subject: One-to-Many Query Help
PostPosted: Thu Aug 25, 2005 7:11 am 
Newbie

Joined: Mon May 09, 2005 7:48 am
Posts: 5
With Hibernate 3.0, I have a simple relationship, even more simplified:

Code:
public class Absence
{
   public String name;
   public Set absenceDetails;

   ...
}

public class AbsenceDetail
{
   public String status;
}


I need to select all Absences, where the name = x and it has to have a AbsenceDetail.status of y.

I have been trying:

Code:
from Absence absence where
:status = all elements(a.absenceDetails.status) and
absence.name= :name


However, I get the error:

Quote:
Root Cause :net.sf.hibernate.QueryException: expecting 'elements' or 'indices' after: name [from Absence absence where
:status = all elements(a.absenceDetails.status) and
absence.name= :name]

Can anyone help?

Regards,
Peter


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 10:14 am 
Newbie

Joined: Fri Jul 30, 2004 9:02 am
Posts: 9
Location: Ukraine
In h3 elements is not supported, so you should use
join
Code:
from Absence a left join a.absenceDetails d
where d.status = :status
and a.name = :name

_________________
--
Let's do a life easier


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

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.