Hibernate中自定义函数不生效?

07-06-30 lyojbuilder
我想让hibernate的hql支持自己定义的函数,例如 test_length 这个函数,就在自己写的一个 Dialect中 TestDialect :
registerFunction("cms_length", new StandardSQLFunction("len", Hibernate.LONG) );
registerFunction("cms_length", new StandardSQLFunction("len", Hibernate.LONG) ); 



我在代码中这样使用:

from Userinfo u where cms_length(u.name)=4
<p class="indent">


但是我在程序中仍然不能使用 cms_length这个函数,这个类是被调用了的,是哪里配置错了?