hibernate的hql中如何实现类型转换

我写的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 大小写开头都试过了

我很不解的是你为什么要 cast(t.id as string) 把你的id转换为string,直接不能查吗?我刚试了下可以查

gethibernateTemplate().find("from Test t where id like '%"+test.getId()+"%' ");
这样查肯定没问题!