This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
in hibernate Types (IntegerType, ....) are used to set values to a PreparedStatement to persist an object and to read values from a ResultSet to transform a persistet object back to a java object.
Hibernate: insert into USERS (LOGON_ID, PASSWORD, RESETTED, WRNGCOUNT, LOCKED, USERS_ID) values (?, ?, ?, ?, ?, ?) java.lang.ClassCastException at org.hibernate.type.IntegerType.set(IntegerType.java:41)
indicates that there is a problem when inserting (that is: creating) a user object. since it happens in the IntegerType i would guess (can you post the User class) that there is a missmatch of types: in your mapping you specify "int" (that's why IntegerType is used) but the field in your User class has another (java) type (e.g. long, short, byte) ?
btw: often you do not need to specify the type attribute, hibernate picks reasonable valueas for default (e.g. String, int, ...).
if you could post the User class....?
Joined: Jan 22, 2005
Thanks for your help. The problem solved. There was a mis match in the data type.