java sql in无效数字_java.sql.SQLException: ORA-01722: 无效数字

[eStore]2011-12-15 13:47:21,890 ERROR Probably an exception caught by Spring MVC, check the debug info which may help identifying the error. | reportError_jsp._jspService(121)

[eStore]2011-12-15 13:47:21,890 ERROR Detailed JSP Exception: | reportError_jsp._jspService(125)

org.hibernate.exception.SQLGrammarException: could not execute query

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

at org.hibernate.loader.Loader.doList(Loader.java:2216)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:595)

Caused by: java.sql.SQLException: ORA-01722: 鏃犳晥鏁板瓧

经过多次测试发现:

String hql="from Customer t where t.telephone='"+tel+"'";//可以

String hql="from Customer t where t.telephone="+tel;//报错

查原因:估计是oracle会将变化一下where to_numer( t.telephone)。

所以出现以上错误,转化一下试试


版权声明:本文为weixin_36410293原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。