-->
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: How to create a entity class in this case
PostPosted: Thu Mar 30, 2006 2:34 am 
Newbie

Joined: Wed Mar 29, 2006 11:54 pm
Posts: 4
Hi

How can i create an entity for a query like below

select t1.name as F!, t2.salary as F2, t1.city as F3, t2.total as F4 from tra_emp t1, tra_salary t2 inner join ref_feature t3 on t1.empid = t3.empid


Regards

_________________
Regards
A.Peter
SCJP,SCWCD


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 1:34 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Can you rephrase your question? Do you already have a class, and you want to create an instance of it from an arbitrary piece of HQL or SQL? Also, can you correct your query? There's no relation between tra_salary and any other table, so that query is going to produce a full cross-join, and I very much doubt that that's what you want.

But briefly, assumng that you've mapped your classes and so on, the sort of HQL code you're looking for is
Code:
select e
from Employee e
join e.Feature f
where e.Name = :Name


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.