-->
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 can i use casting function in HQL?
PostPosted: Tue Feb 13, 2007 3:07 am 
Newbie

Joined: Tue Feb 13, 2007 3:00 am
Posts: 1
I has three PO: A1,A2,B. there is a inheritance mapping between A1 and A2, A2 extends A1,
and A2 has special property "color". in addition, there is a many-to-one mapping between
B and A1.

I want to write some HQL like:

Code:
from B where B.a1.class=A2 and ((A2)(B.a1)).color='red';

but it's failed(phrase error).

My question is how can i get the objective except using:
1.
Code:
select B from B,A2 where B.a1.id=A2.id and A2.color='red'

2.
Code:
from B where B.a1.id in (select A2.id from A2 where A2.color='red')

3. native SQL

Help will be appreciated! (even tell me that my objective is wrong)
Thanks!

greencar2000


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.