-->
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: The problem about Join clause
PostPosted: Wed Apr 14, 2004 1:50 am 
Newbie

Joined: Wed Apr 14, 2004 1:43 am
Posts: 2
I fell in trouble using Hibernate about "Join" clause, it bother my development plan very much.

here is a example
1) SessionFactory sessions = conf.buildSessionFactory();
2) Session s = sessions.openSession();
3) Transaction t = s.beginTransaction();
4) select new UserInfo(c.name,a.account,c.custId) from CustomerDto as c left outer join AccountDto a
5) list = s.find(sql);
...

when the program run at line 5), it throws a exception below as
net.sf.hibernate.QueryException: outer or full join must be followed by path expression [select new UserInfo(c.name,a.account,c.custId) from CustomerDto as c left outer join AccountDto a]

Why? don't Hibernate support Join clause? But I ever see some HQL using Join clause!

Please help me!

best regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 14, 2004 1:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you don't show your mapping file but i suppose this should work
Code:
4) select new UserInfo(c.name,a.account,c.custId) from CustomerDto as c left outer join c.accountDto as a


you're not in pure sql here, so don't forget to read all about HQL


Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 14, 2004 2:24 am 
Newbie

Joined: Wed Apr 14, 2004 1:43 am
Posts: 2
Successfully! The problem occur in CustomerDto.cfg.xml that don't reference to AccountDto.

Thank you very much!


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.