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

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.