-->
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.  [ 5 posts ] 
Author Message
 Post subject: outer or full join must be followed by path expression ?!
PostPosted: Wed Nov 10, 2004 3:20 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
I write a simple hibernate query.But get exception

Code:
outer or full join must be followed by path expression


My code is:
Code:
      Session s=HibernateLocalUtil.currentSession();
      Transaction t=s.beginTransaction();
      
            String sql="select p.ProjectCode,a.Name from com.digitalchina.gx.common.bean.PubProStatus p left join com.digitalchina.gx.common.bean.PubApplyProinfo a where p.ProjectCode=a.ApplyCode";
      List list=s.createQuery(sql).list();
      System.out.println("get list: >> "+list);
      

      t.commit();
      HibernateUtil.closeSession();

why this simple code report error? Thks
How to use join query? Help!

_________________
You are not alone...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 21, 2004 4:06 am 
Newbie

Joined: Mon Oct 11, 2004 3:51 am
Posts: 1
I also want to know...[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 21, 2004 4:36 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
try

Code:
select p.ProjectCode,a.Name from com.digitalchina.gx.common.bean.PubProStatus p, com.digitalchina.gx.common.bean.PubApplyProinfo a where p.ProjectCode=a.ApplyCode


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 21, 2004 5:06 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
BTW:
Joins are supported only for associations managed by hibernate. This means you could get your stuff working by adding the association to the mapping. This would be the path hibernate is asking for.

HTH
Ernst


Top
 Profile  
 
 Post subject: :)
PostPosted: Wed Dec 22, 2004 2:04 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
ernst_pluess wrote:
BTW:
Joins are supported only for associations managed by hibernate. This means you could get your stuff working by adding the association to the mapping. This would be the path hibernate is asking for.

HTH
Ernst


Thks ernst_pluess!

You are right! In the previous, my two tables have not any associations.They associate using a column simply. I add associations to mappings and the query works well. It mean that if I use "join", I need have to make Hibernate to know the association with two tables in mapping.

That is exactly what you said.
Code:
Joins are supported only for associations managed by hibernate.


:)

Thks

_________________
You are not alone...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.