What am I trying to do ? While loading my project I get a weird exception:
rezg.admin.server.objects.common.pojo.EmailLogDetails, setter method of property: id
I am to save the object (persist) to the DB, using postgres. Environment is Java 6 , Hibernate 3 in Jboss 4 Environment. The jar contains "EmailLogDetails" is in the Jboss lib folder.
expected type: java.lang.Integer, actual value: java.lang.Integer IllegalArgumentException in class: rezg.admin.server.objects.common.pojo.EmailLogDetails, setter method of property: id
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of rezg.admin.server.objects.common.pojo.EmailLogDetails.Id at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104) at org.hibernate.tuple.AbstractEntityTuplizer.setIdentifier(AbstractEntityTuplizer.java:204) at org.hibernate.persister.entity.AbstractEntityPersister.setIdentifier(AbstractEntityPersister.java:3261) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:157) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114).....
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42) ... 74 more
EmailLogDetails:
public class EmailLogDetails implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private java.lang.Integer id;
private String reservationNo;
private String mailSubject;
private String fromAddress;
public String getFromAddress() {
return fromAddress;
}
public void setFromAddress(String fromAddress) {
this.fromAddress = fromAddress;
}
public java.lang.Integer getId() {
return id;
}
public void setId(java.lang.Integer id) {
this.id = id;
}
public String getMailSubject() {
return mailSubject;
}
public void setMailSubject(String mailSubject) {
this.mailSubject = mailSubject;
}
public String getMailType() {
return mailType;
}
}
XML
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"../server/default/conf/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" schema="@@portalname@@_admin">
<class name="rezg.admin.server.objects.common.pojo.EmailLogDetails" table="emaillogdetails">
<id name="Id" column="id" type="java.lang.Integer">
<generator class="sequence">
<param name="sequence">@@portalname@@_admin.seq_emaillogdetails</param>
</generator>
</id>
<property name="reservationNo" type="java.lang.String" >
<column name="reservationno" length="20" not-null="false" sql-type="varchar" />
</property>
<property name="mailSubject" type="java.lang.String" >
<column name="mailsubject" length="500" not-null="false" sql-type="varchar" />
</property>