-->
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: Unexpected token: . in statement
PostPosted: Mon Apr 19, 2010 8:59 pm 
Newbie

Joined: Thu Jul 16, 2009 6:54 am
Posts: 2
I am having a structure which looks like this:

Code:
public class tableA {
      ...
     @OneToOne
     private tableB b;

     @OneToMany
     @JoinTable(name = "tableA_tableE", joinColumns = @JoinColumn(name = "tableA_id"), inverseJoinColumns = @JoinColumn(name = "tableE_id"))
     private List<tableE> es;
     ...
}

public class tableC {
    ...
    @OneToOne
    private tableD d;
}

public class tableE {
    ...
   @OneToMany
   private List<tableD> es;
   ...
}

public class tableD {
   ...
   @ManyToOne
   private tableE e;
}



This HQL query to selects rows from tableC given an instance of tableB:
Code:
select obj_ from tableC obj_  where obj_.d.e IN (select obj2_.es from tableA obj2_ where obj2_.b=:parameter)


When executing the query I get this error: Unexpected token: . in statement
The generated SQL has . instead of obj2_es

Can anybody help, please?

Thanks


Top
 Profile  
 
 Post subject: Re: Unexpected token: . in statement
PostPosted: Tue Apr 20, 2010 3:10 am 
Regular
Regular

Joined: Wed Mar 10, 2010 4:48 am
Posts: 106
nagib.cs wrote:
select obj_ from tableC obj_ where obj_.d.e IN (select obj2_.es from tableA obj2_ where obj2_.b=:parameter)

Note: you could also use:
Code:
from tableC where d.e IN (select es from tableA where b = parameter)


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.