-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL Help
PostPosted: Tue Mar 21, 2006 2:10 am 
Newbie

Joined: Tue Mar 21, 2006 1:56 am
Posts: 4
I need help with an HQL query. I have the following tables:
Person
personID
FirstName
LastName

Hire
HireID
PersonID (FK)
JobTitle

I also have the Person object and the Hire object. the Hire object.
the SQL i need is: select * from Person left join Hire on hire.personID = person.personid

So I need person objects !!!!!

the HQL that does a query is: "from Person as p , Hire as hire where ..."

But this results in the cast error :At least one element in the source array could not be cast down to the destination array type

I have looked all over the web for an answer..... I have tried many different HQL statements but all have invalid token errors.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 6:02 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Add a select clause:
Code:
select p from Person as p, Hire as hire where ...


Top
 Profile  
 
 Post subject: Still Errors
PostPosted: Tue Mar 21, 2006 12:00 pm 
Newbie

Joined: Tue Mar 21, 2006 1:56 am
Posts: 4
hql = "select p from person as p, Hire as hire where hire.StartDate >= :HireDateMin and hire.StartDate <= :HireDateMax";


I tried that and get the following:

NHibernate.QueryException : unexpected token: as [select p from person as p, Unicru.Persistence.BusinessObjects.Hire as hire where hire.StartDate >= :HireDateMin and hire.StartDate <= :HireDateMax]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.