`
lin213_213
  • 浏览: 76373 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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)。

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

分享到:
评论
1 楼 zhuzf 2012-09-19  
我也出现这样的问题,但我的问题是:查询的语句中的字段与实体中的属性不一致,才会出现这样的问题。

相关推荐

Global site tag (gtag.js) - Google Analytics