-->
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.  [ 10 posts ] 
Author Message
 Post subject: Unable to have the WITH operator to work, even with 3.1 RC1
PostPosted: Tue Oct 11, 2005 9:58 am 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
I'm trying to query (hql) with an extra condition on a join but keep receiving the message:

Code:
Caused by: line 1:74: unexpected token: with
   at org.hibernate.hql.antlr.HqlBaseParser.fromJoin(HqlBaseParser.java:1380)
   at org.hibernate.hql.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1053)
   at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:759)


From a simply query like:

Code:
from Synset s
left join s.terms st
with st.audit.author = 'fdelisle'


In this query, audit is a component in

I'm 100% sure I use the latest rc1 hibernate jars (reviewed my projects settings several times).

I can see in hibernate 3.1 rc1 grammar folder that the file hql.g contains:

Code:
fromJoin
   : ( ( ( LEFT | RIGHT ) (OUTER)? ) | FULL | INNER )? JOIN^ (FETCH)?
     path (asAlias)? (propertyFetch)? (withClause)?
   ;
withClause
   : WITH^ logicalExpression
   ;


I know I can use filters to get extra conditions on a join, but the query I'm really concerned with (the one pasted here is a simple example) do something like:

select a from A a
left join a.bs
with bs.field = :condition
left join fetch a.bs <- filter is applied to this collection instance also, and I don't want filtering for these one.

Is there any JUnit test included with this hibernate release testing the With operator so I can try it out?

Thank you very much,

Hibernate version:
3.1 rc1
Mapping documents:
Not relevant
Code between sessionFactory.openSession() and session.close():
Not relevant
Full stack trace of any exception that occurs:
No Exception
Name and version of the database you are using:
Not Relevant
The generated SQL (show_sql=true):
Doesn't reach this point
Debug level Hibernate log excerpt:
Will post on demand.

_________________
- Frank


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 11:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Sure there are unit tests: org.hibernate.test.hql.AdHocOnTest

What does Hibernate print out as the version when you build the SessionFactory (check the debug log)?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:02 pm 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
Even if I'm using the latest rc1 hibernate3.jar (I open the file, check out the manifest and see

Code:
Hibernate-Version: 3.1.rc1


It prints 3.0.5 ! How can this be possible...

I replaced all other jars by the ones included in the 3.1 rc1 release.

I'm really confused. I'm rebuilding my project from scratch. But I know that I'm not importing the same class paths several times, etc.

It may be a problem with eclipse.. (yes, I did refresh my project...)

Anyway, thanks, you gave me a way to known for sure the hibernate's version.

Is this version (printed in log.level = debug) read from the hibernate3.jar manifest?

[/code]

_________________
- Frank


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
No, its read from the org.hibernate.cfg.Environment class. Its a hard coded value in there...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:16 pm 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
Yup, test passed.

When you start having alot of interconnected projects in eclipse and that you need to point to a jar (in my case hibernate3.jar) to compile... In fact I had my project (from which I was running) pointing to hibernate3.jar, but this one related to another project which was pointing to an old hibernate3.jar. Well, this last jar copy was considered.

In fact I didn't look in that last project because Its a project that I have splitted.. and blablab. not needing hibernate3.jar anymore...

Thank you.

(I need to justify, I look like a newb)

_________________
- Frank


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:52 pm 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
It is the first time I work with 3.1 and when switching from 3.0.5 to this new version (tested with beta2 and rc1), I get an exception on the first query.

On the screen I get:

Code:
hibernate: null


following by

Code:
Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute query


If I put back hibernate3.jar 3.0.5, there's no problem.

Weird.

You have an idea?[/code]

_________________
- Frank


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
But of course. I've only answered the same exact question 5 times already this week; I even have it memorized by now...

Hint: look at your interceptor (see I even know you are using an interceptor ;)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 1:06 pm 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
Thank you lord, thank you Jesus!

I'm sorry I ask silly question, but the point is that I have to be code complete in 1h for a release.

I replaced

Code:
   public String onPrepareStatement(String arg0) {
      return null;
   }


by

Code:
   public String onPrepareStatement(String arg0) {
      return arg0;
   }


Yippie ;)

_________________
- Frank


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 1:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Just extend org.hibernate.EmptyInterceptor and just override the methods you care about; that way you isolate yourself from furture additions


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 1:12 pm 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
Done.

Thanks again. You saved me.

_________________
- Frank


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