The method load(Class, Serializable) in the type HibernateTemplate is not applicable for the arguments (Class, int)

引入别人的项目发现利用HibernateTemplate的load的方法报错了。错误提示为:

The method load(Class, Serializable) in the type HibernateTemplate is not applicable for the arguments (Class, int)

意思为load方法的第二个参数是实现Serializable接口的对象,int类型不符合。但jdk自动装箱,int会自转换为Integer,而Integer是实现了Serializable的,所以应该是可以的。但myeclipse偏偏报错了,原因是我的myeclipse中window->preferences->java-compiler中的Compiler compliance level设置为1.4。

解决方法是把window->preferences->java-compiler中的Compiler compliance level成1.6

或者强制转换一下。

改成

 

posted @ 2016-10-22 12:36  139亿  阅读(4439)  评论(0编辑  收藏  举报