-->
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.  [ 6 posts ] 
Author Message
 Post subject: how to include left join fetch in a filter?
PostPosted: Mon Sep 27, 2004 10:32 am 
Newbie

Joined: Tue Jul 06, 2004 12:39 pm
Posts: 5
Hi,

I just would like to know how to create a filter on a collection with a left join fetch clause in it so that hibernate will fetch all the information I need in the same sql statement.
I've looked in the documentation but I didn't find anything about it.
I've tried it in many different ways with no luck, such as:
"from this left join fetch this.rooms"
"from left join fetch this.rooms"
"from fetch this.rooms"

Please, is there a way to do it?

Thank you.

Luis Fernando

_________________
Luis Fernando Kauer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2004 10:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
"left join fetch this.rooms"

(I think that will work, but not 100% sure)


Top
 Profile  
 
 Post subject: It doesn't work
PostPosted: Mon Sep 27, 2004 11:32 am 
Newbie

Joined: Tue Jul 06, 2004 12:39 pm
Posts: 5
Thanks for the reply, but it doesn't work.

Here is the stack trace:
net.sf.hibernate.QueryException: query must begin with SELECT or FROM: left [left join fetch this.rooms]
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:84)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.hql.FilterTranslator.compile(FilterTranslator.java:26)
at net.sf.hibernate.impl.SessionFactoryImpl.getFilter(SessionFactoryImpl.java:305)
at net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3452)
at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3509)
at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3404)

_________________
Luis Fernando Kauer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2004 12:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
oh well, in that case its not possible .. use a full query instead.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2004 2:25 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
lfkauer,
are you sure you've tried "select this from this left join fetch this.rooms" ??

just an idea.... i'm not sure

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: Didn't work either
PostPosted: Mon Sep 27, 2004 4:12 pm 
Newbie

Joined: Tue Jul 06, 2004 12:39 pm
Posts: 5
Anthony,

Thanks for the try, but it didn't work either.
I've already tried it in many different ways, but if you have any other ideas, I'll be glad to try them too.

Here is the stack trace:

net.sf.hibernate.QueryException: unexpected token: left [select this from this left join fetch this.rooms]
at net.sf.hibernate.hql.FromParser.token(FromParser.java:77)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.hql.FilterTranslator.compile(FilterTranslator.java:26)
at net.sf.hibernate.impl.SessionFactoryImpl.getFilter(SessionFactoryImpl.java:305)
at net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3452)
at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3509)
at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3404)

_________________
Luis Fernando Kauer


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