java - Hibernate: could not read column value from result set:Fail to convert to internal representation -
i trying fetch values db. have configured hibernate successfully. below hbm file , pojo class.
<class name="usermasterbean" table="employee_master"> <id name="id" type="long"> <column name="emp_id" length="10" /> <generator class="assigned" /> </id> <property name="firstname" type="string"> <column name="emp_first_name" length="30" not-null="true" /> </property> <property name="secondname" type="string"> <column name="emp_second_name" length="30" /> </property> <property name="lastname" type="string"> <column name="emp_last_name" length="30" /> </property> <property name="empdob" type="date"> <column name="emp_dob" length="7" not-null="true" /> </property> <property name="empdoj" type="date"> <column name="emp_doj" length="7" not-null="true" /> </property> <property name="emppermadd1" type="string"> <column name="emp_perm_add1" length="50" not-null="true" /> </property> <!--other properties removed-->
below pojo class
public class usermasterbean { private long id; private string loginname; private string password; private string type; private string loginyn; private string salutation; private string firstname; private string secondname; private string lastname; private string gender; private string maritalstatus; private string pagerno; private string phoneno; private string mobileno; private string emailid; private string personalmailid; private long companyid; private string companyname; private long worldwideregion; private long country; private long localregion; private long state; private long city; private long department; private string curriculum; private string dn; private string photopath; private java.sql.timestamp empdob; private java.sql.timestamp empdoj; private java.sql.timestamp empdol; private java.sql.timestamp empdoc; private string emppanno; private string empbloodgroup; private string empcurrcband; private string emppassportno; private string empmanager; public string getfieldprefix() { return fieldprefix; } public long getid() { return id; } public string getloginname() { return loginname; } public string getpassword() { return password; } public string gettype() { return type; } public string getloginyn() { return loginyn; } public string getsalutation() { return salutation; } public string getfirstname() { return firstname; } public string getsecondname() { return secondname; } public string getlastname() { return lastname; } /* amit gupte - modified - iuser begin */ public string getmiddlename() { return secondname; } public string getname() { return firstname + " " + lastname; } /* amit gupte - modified - iuser end*/ public string getgender() { return gender; } public string getmaritalstatus() { return maritalstatus; } public string getpagerno() { return pagerno; } public string getphoneno() { return phoneno; } public string getmobileno() { return mobileno; } public string getemailid() { return emailid; } public string getpersonalmailid() { return personalmailid; } public long getcompanyid() { return companyid; } public string getcompanyname() { return companyname; } public long getworldwideregion() { return worldwideregion; } public long getcountry() { return country; } public long getlocalregion() { return localregion; } public long getstate() { return state; } public long getcity() { return city; } public long getdepartment() { return department; } public string getcurriculum() { return curriculum; } public string getdn() { return dn; } public string getphotopath() { return photopath; } public java.sql.timestamp getempdob() { return empdob; } public java.sql.timestamp getempdoj() { return empdoj; } public java.sql.timestamp getempdol() { return empdol; } public java.sql.timestamp getempdoc() { return empdoc; } public string getemppanno() { return emppanno; } public string getempbloodgroup() { return empbloodgroup; } public string getempcurrcband() { return empcurrcband; } public string getemppassportno() { return emppassportno; } public string getempmanager() { return empmanager; } //other methods removed
}
i facing below error.
sep 04, 2013 11:50:19 org.hibernate.type.nullabletype nullsafeget info: not read column value result set: emp1_0_; fail convert internal representation sep 04, 2013 11:50:19 org.hibernate.util.jdbcexceptionreporter logexceptions warning: sql error: 17059, sqlstate: 99999 sep 04, 2013 11:50:19 org.hibernate.util.jdbcexceptionreporter logexceptions severe: fail convert internal representation
i not getting wrong code.
i querying
string hql = "from usermasterbean"; list emplist = attendance.getlist(hql, factory);
for other classes working
this error thrown when getint (or other numeric type) called varchar value not string representation of number. if varchar column contains 'bob' , call getint on column, you'll error.
Comments
Post a Comment