[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3992) SQLServer "contains" boolean predicate not handled in HQL

Scott Van Wart (JIRA) noreply at atlassian.com
Thu Jun 25 16:19:34 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33473#action_33473 ] 

Scott Van Wart commented on HHH-3992:
-------------------------------------

https://forum.hibernate.org/viewtopic.php?f=25&t=987183

Not sure if this is useful at all, but I might see what was done in nhibernate to add this functionality.

> SQLServer "contains" boolean predicate not handled in HQL
> ---------------------------------------------------------
>
>                 Key: HHH-3992
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3992
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: query-hql
>    Affects Versions: 3.3.1, 3.3.2
>         Environment: Hibernate core 3.3.1, JDK 1.6, SQLServer 2003
>            Reporter: Scott Van Wart
>
> The following HQL:
>   select pp from Product pp where CONTAINS( pp.keywords, :keywords )
> Will throw this exception:
> org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: ( near line 1, column 33 [select pp from Product pp where CONTAINS( pp.keywords, :keywords )]
> 	at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
> 	at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
> 	at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:258)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
> 	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
> 	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
> 	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
> 	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
> I tried changing it to this:
>   select pp from Product pp where CONTAINS( pp.keywords, :keywords ) = TRUE
> But then SQL Server doesn't like it (it produces SQL like "CONTAINS(pkgproduct0_.keywords, ?)=1":
> org.hibernate.exception.SQLGrammarException: could not execute query using scroll
> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '='.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list