0

I am using spring with hibernate in my project.
I am new to springs.
I am getting this exception in browser when i send request to a action class.
org.springframework.orm.hibernate3.HibernateQueryException: unexpected AST node: diet near line 1, column 94 [select productCatNo from ds.ORM.ProductCatSubcat pcs where pcs.productSubcatName=kitchen and diet]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: diet near line 1, column 94 [select productCatNo from ds.ORM.ProductCatSubcat pcs where pcs.productSubcatName=kitchen and diet]

why this exception coming

my hibernate query is
hibernateTemplate.find("select productCatNo from ProductCatSubcat pcs where pcs.productSubcatName="+top_cat)

where top_cat is a java variable.

thanks,
suresh.k

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by BestJewSinceJC
0

Because the "and diet" portion of the query is invalid syntax. It must be getting appended to the end of your query from somewhere, so figure out where it gets appended to the query, and either remove it, or make it a properly formatted query (e.g. and diet=something).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.