reset password
Author Message
avdhesh
Posts: 3
Posted 22:16 May 27, 2009 |

Hi Professor,

 

I have trouble executing search query.

My query is select * from blog_entries where to_tsvector(title||content) @@ to_tsquery(?);

This works on viewBlogs page but it gives error on viewBlog page.

Error in log file is as below :

ERROR JDBCExceptionReporter: ERROR: syntax error at or near "limit"

ERROR ExceptionResolver: Exception caused by user guest

ExceptionResolver: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query

ERROR ExceptionResolver: org.springframework.dao.

InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
    at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:615)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
    at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:984)
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:980)
    at csns.model.blog.dao.hibernate.BlogEntryDaoImpl.searchEntries(BlogEntryDaoImpl.java:49)
ellen214
Posts: 11
Posted 00:31 May 28, 2009 |

I have the same problem too...

If run viewBlog first then viewBlogs...it works...

however...

if run viewBlogs first then viewBlog...I get the same errors as yours

~"~...who knows why?

cysun
Posts: 2935
Posted 07:41 May 28, 2009 |
avdhesh wrote:

...

My query is select * from blog_entries where to_tsvector(title||content) @@ to_tsquery(?);

...

If that's your query, how come the error message says syntax error at or near "limit"? The error message seems pretty clear. Just check the query syntax, and of course, make sure it's executing the query that you think it's executing.

cysun
Posts: 2935
Posted 21:28 May 28, 2009 |

More on this problem here.