Joined: Wed Sep 17, 2014 11:05 am Posts: 1
|
Hi All,
Please help us regarding below issue
We are using hibernate3.jar and all mapping files and entity classes looks fine but still we are getting the below exception
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.entity.GroupParent.parent at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104) at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337) at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Please find the below mapping file and entity class
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping>
<class name="GroupParent" table="TROUBLE_GROUP" schema="TEST" dynamic-insert="true" dynamic-update="true">
<id name="id" type="java.lang.Long" column="ID"> <generator class="sequence"> <param name="sequence">TROUBLE_GROUP_SEQ</param> </generator> </id>
<property name="version" type="java.lang.Long" column="VERSION" length="16"/> <property name="ticketNumber" type="java.lang.String" column="TICKET_NUMBER" not-null="true" length="25"/> <----------------- SO ON ------ WE HAVE OTHER MAPPINGS> <many-to-one name="parent" class="GroupParent" column="PARENT_ID" not-null="false" lazy="false"/> </class> </hibernate-mapping> ---------------------------------------------------------------------------------------------------- ENTITY Class: GroupParent.java ------------------ public class GroupParent implements Group {
private Group parent; void setParentId(Long parentId) { this.parentId = parentId; }
}
==================================
the answer for the above issue is we have changed the field name from name="parent" to name = "par" . We didnt know why hibernate is behaving like this???? may be parent field name willnot be allowed by hibernate??
|
|