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

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

意思为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

或者强制转换一下。

改成

时间: 2024-10-08 17:31:29

The method load(Class, Serializable) in the type HibernateTemplate is not applicable for the arguments (Class, int)的相关文章

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

Transaction transaction = session.beginTransaction(); //load是通过主键属性,获取对象的实例 Employee employee  =(Employee) session.load(Employee.class, 1); employee.setName("demo"); transaction.commit(); session.close(); 报错The method load(Class, Serializable) i

The method sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)

写了一段测试代码运行时一直报错:The method sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String) 测试代码: driver.findElement(By.name("wd")).sendKeys("selnium"); 原因:旧版本的Java不理解非随机变量参数 解决方法:在工程上点击右键选择Build Path -> 

错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)

Fragment newfragment =new MyFragment();fragmentTransaction.replace(R.layout.activity_main,newfragment ).commit(); 提示错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment) 妈蛋,找了好久!一直以

The method setItems(String) in the type ForTokensTag is not applicable for the arguments (Object)

1. 问题 看到这个错误以为是貌似jsp页面有误,c:forTokens标签用错了?? An error occurred at line: 444 in the jsp file: /WEB-INF/pages/countOrder/viewCountOrderDetails.jsp The method setItems(String) in the type ForTokensTag is not applicable for the arguments (Object) 441: </t

The method sort(Comparable[]) in the type Shell is not applicable for the arguments (int[])

看算法第四版的希尔排序时,打算把例中的String数组换成int数组,却出现了上面的问题.最后在StackOverflow找到答案原代码: package sort; import edu.princeton.cs.algs4.In; public class Shell{ public static void sort(Comparable[] a) { //将a[]升序排列 int N = a.length; int h = 1; while (h<N/3) h = 3*h + 1; //

The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the

 The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String) 今天遇到这样一个很奇葩的错误信息,后来查到我导入的包有问题  import android.app.Fragment; import android.app.FragmentManager;   其实我应该使用的

Tomcat6服务端工程部署Tomcat8遇到的 “The method getDispatcherType() is undefined for the type HttpServletRequest” 问题

一个安卓服务端程序起初部署在Tomcat6.0当中,但是当我用Tomcat8.0部署时,出现了一个错误: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [52] in the generated java file: [D:\apache-tomcat-8.0.15\work\Catalina\localhost\allRunServer\org\apa

The method getTextContent() is undefined for the type Node

The method getTextContent() is undefined for the type Node eclipse 中 如果加入了 其他了xfire 等其他xml解析包的话,使用org.w3c.dom.Node下的getTextContent()方法会出现The method getTextContent() is undefined for the type Node 提示,解决方法如下: project-->properties->java build path-->

The method getTextContent() is undefined for the type Element

使用org.w3c.dom解析XML,有时可能会报错The method getTextContent() is undefined for the type Element/Node,这种情况可能是加入了其他的XML解析jar包. 解决方法如下: 将Project->Properties->Java Build Path->Order and Export->JRE System Library移动到顶部(Top)