`
xp9802
  • 浏览: 1211852 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Provided id of the wrong type for class

阅读更多

常见Hibernate异常org.hibernate.TypeMismatchException: Provided id of the wrong type for class:

严重: Servlet.service() for servlet action threw exception
org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.uitest.domain.Product. Expected: class java.lang.Long, got class java.lang.String
 at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:109)
 at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
 at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)
 at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)
 at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:531)
 at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
 at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
 at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:525)

通常这种错误是由于ID类型不对引起的!!!

解决的办法:检查下ID的类型,把页面串回来的id值由string没转换成Long类型,再进行删除,就可以了。

2
2
分享到:
评论
2 楼 jayyunfei 2012-03-19  
但是如果我在实体类中把id改成Long,修改就能转过去,但是在保存的时候又报错,说类型不对,
1 楼 jayyunfei 2012-03-19  
我改了,怎么还是不行,在action中获取id以后,我用Long.parsLong("id");a怎么还报这个错?

相关推荐

    Java邮件开发Fundamentals of the JavaMail API

    take advantage of protocols for which Sun does not provide out-of-the-box support. You'll find support for NNTP (Network News Transport Protocol) [newsgroups], S/MIME (Secure Multipurpose Internet ...

    c++实验三、四.pdf

    The Student class has private member variables for the student's information, including student ID, name, gender, birthday, grade, class, department, and major. The class has multiple constructors, ...

    英文原版-MR Imaging of the Abdomen and Pelvis 1st Edition

    "The quality of the images provided is exemplary!...The book can be used as a learning tool for residents and as a great reference for fellows and practicing radiologists" - The Bookshelf February ...

    SMDK for DotNet

    Please refer to the Readme.htm file provided with the SMDK for .NET for the latest information on updating your terminal for use with the class libraries and for information on how to deploy your ...

    266.rar_Type-2_fuzzy approximation _interval_interval fuzzy _int

    This paper shows a proposal for Type-...provided and used for computing the centroid of an Interval Type-2 fuzzy set through a mapping of its membership function, instead of its universe of discourse.

    OpenGL Programming for the X Windows System

    Source code for all the examples provided, and for the GLUT library itself, are available for downloading via the Internet. Intended for C programmers familiar with the Xlib and/or Motif programming ...

    The Complexity of Theorem-Proving Procedures

    in polynomial time provided an oracle is available for solving the second. From this notion of reducible, polynomial degrees of difficulty are defined, and it is shown that the problem of determining ...

    世界地图 the map of world

    一幅超清晰的地图! 程序员也应该有自己的爱好,喜欢的可以看看!

    ADOL-C a package for the automatic differentiation of algorithms written in C C++

    For solution curves defined by ordinary differential equations, special routines are provided that evaluate the Taylor coefficient vectors and their Jacobians with respect to the current state vector....

    英文原版-The Evolution of the Primate Hand 1st Edition

     Across the chapters, different authors have addressed a variety of specific questions and provided their perspectives, but all explore the main themes described above to provide an overarching ...

    Development of an Optimal Vehicle-to-Grid Aggregator for Frequency Regulation

    For vehicle-to-grid (V2G) frequency regulation services, we propose an aggregator that makes efficient use of the distributed power of electric vehicles to produce the desired grid-scale power. The ...

    MySQL for the Internet of Things(Apress,2016)

    This book introduces the problems facing Internet of Things developers and explores current technologies and techniques to help you manage, mine, and make sense of the data being collected through the...

    计算机网络第六版答案

    This document contains the solutions to review questions and problems for the 5th edition of Computer Networking: A Top-Down Approach by Jim Kurose and Keith Ross. These solutions are being made ...

    class notes for DataStructures

    These lecture notes grew out of class notes provided for the students in CSCI 104 (“Data Structures and Object-Oriented Design”) at the University of Southern California in Fall of 2013.

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    (the last one can be overridden for the implementation of new alignment rules). - ADD: The property TFlexPanel.GridControl moved to the public section and is now available for writing (during the ...

Global site tag (gtag.js) - Google Analytics