我写的hql如下:
from Test t where cast(t.id as string) like '%"+test.getId().toString()+"%'
出现异常如下,好像是hql错误,但不知道怎么改
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'string)like '%1%' )' at line 1
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:612)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:377)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:840)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:832)
at com.jidi.dao.impl.TestDaoImpl.findTest(TestDaoImpl.java:26)
String 大小写开头都试过了