-->
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: Any way to use native sql filters on non-native sql queries?
PostPosted: Fri Mar 30, 2007 2:09 pm 
Newbie

Joined: Wed Dec 13, 2006 5:35 pm
Posts: 4
Hibernate version: 3.2.0 ga

I'm trying to create a Filter on a class via the @FilterDef/@Filter annotations. The Filter uses the "connect by" keyword, i.e. it involves native sql syntax. Everything works fine when I enable the filter and run a native SQL query involving that class. However, it fails when the query is enabled and I run a query using HQL.

Looking at the sql output, it's clearly assuming that the filter clause is HQL and is treating the words "connect" "by" "start" "with" etc as fields. Thus, it tries to append the default table name to them, resulting in raw SQL like
Quote:
TABLE.connect TABLE.by

etc

I guess it makes sense, since the filter clause is probably just being appended as an additional "where" clause before it is converted to raw sql.

Does anyone know if there is a way to get around this without converting all filtered queries to be native SQL? maybe a way to "escape" the filter clause so it somehow get deferred until after the SQL is generated or something?

thanks,
Pete


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 16, 2007 7:55 pm 
Newbie

Joined: Wed Dec 13, 2006 5:35 pm
Posts: 4
Still no luck with this... one thing I've tried is setting up query substitutions for the oracle specific syntax eg.
-Dhibernate.query.substitutions="connect=CONNECT, by=BY, prior=PRIOR, start=START, with=WITH" etc.
My hope was that this would cause those words in the filter to be "passed through" to SQL (or translated into themselves) instead of being read as possible field names and getting the table name appended to them.

Unfortunately, even with the substitutions being loaded (Verified this by setting breakpoints in the initialization logic of them), they don't seem to be applied to the filter part of the query.

Any ideas? If there was just a way to "trick" the hibernate hql parser into not appending those table names to those words, I'd be all set.


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.