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

或者强制转换一下。

改成

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM