整合三大框架出现的一些常见的问题及解决的方案

2014年12月29日09:48:19 天气晴 心情好

①、今天在整合三大框架的时候,出现了两个异常,在网上看了很多的文章。所有的文章都指向hibernate的问题,于是我就从这几方面去排查,一:hibernatejar包,二:hibernate配置文件,三:hibernate的实体映射文件(我用的是注解的方式来的)。经过一一排查后发现,我把id的类型写成了string的类型。


org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:91)
at org.hibernate.loader.Loader.getResultSet(Loader.java:2065)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1862)


Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mydb.tbl_employee' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)


②、在做删除功能时,发现数据库已经删除了数据,但是跳转的时候却出现404的异常。经过检查,发现在sturts.xml配置文件中<result name="listAllEmps">/employee!listAllEmps.action</result>,因为result的type属性默认的值是dipatcher,而我需要是重定向到这个action下,所以添加了

type="redirect"就可以了


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章