-->
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 to give a Simple Join Query
PostPosted: Thu Jun 10, 2004 5:17 am 
Newbie

Joined: Sun Apr 11, 2004 9:38 am
Posts: 12
Hi,

I am trying to join 2 tables with the following query:-

select person.first_name
from RefPerson person inner join RefTruck truck where truck.modify_person_num = person.person_num
and truck.modify_person_num = '1'

Schema of the classes is as follows:-
RefPerson:-
CREATE TABLE [dbo].[REF_PERSON] (
[person_num] [TPT_Num] NOT NULL ,
[first_name] [TPT_Name] NOT NULL ,
[last_name] [TPT_Name] NOT NULL ,
[middle_name] [TPT_Name] NULL ,
[person_initials] [TPT_Sm_3] NOT NULL ,
[company_num] [TPT_Num] NULL ,
[contact_type_cd] [TPT_Cd] NULL ,
[job_title_ind] [TPT_Ind] NOT NULL ,
[trading_desk_cd] [TPT_Cd] NULL ,
[login_cd] [TPT_Cd] NULL ,
[user_type_ind] [TPT_Ind] NOT NULL ,
[conf_contact_ind] [TPT_Ind] NULL ,
[invoice_contact_ind] [TPT_Ind] NULL ,
[note_num] [TPT_Num] NULL ,
[status_ind] [TPT_Ind] NOT NULL ,
[last_modify_dt] [TPT_Dt] NOT NULL ,
[lock_num] [TPT_Locknum] NOT NULL ,
[modify_person_num] [TPT_Num] NULL
)


RefTruck:-
CREATE TABLE [dbo].[REF_TRUCK] (
[mot_num] [TPT_Num] NOT NULL ,
[truck_cd] [TPT_Cd] NULL ,
[truck_name] [TPT_Cd_30] NULL ,
[status_ind] [TPT_Ind] NOT NULL ,
[last_modify_dt] [TPT_Dt] NOT NULL ,
[modify_person_num] [TPT_Num] NOT NULL ,
[lock_num] [TPT_Locknum] NOT NULL
)

However, I get the following exception in Hibern8IDE on query execution:-


1 errors occurred while listing (and calling getPathNames).
net.sf.hibernate.QueryException: outer or full join must be followed by path expression [select person.first_name
from com.tpt.physops.referencedata.tableobjects.RefPerson person inner join RefTruck truck where truck.modify_person_num = person.person_num
and truck.modify_person_num = '1']

What is wrong? I cant seem to get how to use joins with Hibernate.


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.