My Hibernate version is Core 3.3.1.GA,I use getHibernateTemplate() to look up a record,like follows:
[code]this.getHibernateTemplate().find("from mytable where id='0001'");[/code]
above code can run well,then I make another query,like follows:
[code]this.getHibernateTemplate().find("from mytable where id<>'0002'");[/code]
This time it raise errors:
org.springframework.orm.hibernate3.HibernateQueryE xception: unexpected token: <> near line 1, column 41 [from mytable id <>'0002']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: <> near line 1, column 41 [from mytable where id <>'0002']
Then I use '!=' to replace '<>',this time it still raise error:
org.springframework.orm.hibernate3.HibernateQueryE xception: unexpected token: != near line 1, column 41 [from mytable id !='0002']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: != near line 1, column 41 [from mytable where id !='0002']
Why? How to use <> or != in above code?
Thanks!
|