Hibernate : org.hibernate.PropertyAccessException: IllegalArgumentException


I hv a parent table (MHS_USER) and associated child table (GROUP) mapped with ManyToMany relation as below (the related code snippet following)
@Entity
@Table(name = "mhs_user")
public class MHSUser extends implements Comparable {
@ManyToMany(fetch = FetchType.EAGER cascade = { CascadeType.ALL })
@JoinTable(name = "user_group_rel" joinColumns = @JoinColumn(name = "mhs_user_id") inverseJoinColumns = @JoinColumn(name = "group_id"))
public List getGroups() {
return groups;
}
public void setGroups(List groups) {
this.groups = groups;
}
}

In the above mhs_user_id is the identity column in the MHS_USER table and grp_id is the identity key in the GROUP table. USER_GROUP_REL table is the join table that contain the relation between the two. When I persist a new member instance it works as expected (by inserting a record into the parent table as well as the child table). However when I try updating any values to the member instance PropertyAccessException is thrown. following is the selective stack trace
------------------------------------------------------------------------------------------
1/14/11 13:59:10:154 CST 0000004b SystemErr R Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of edu.mayo.hcdm.mhsr.businessobject.Group.id
at org.hibernate.feature.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183)
………………………………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………………………..
……………………………………………………………………………………………………………………………………………….. 1/14/11 13:59:10:154 CST 0000004b SystemErr R ... 90 more
1/14/11 13:59:10:154 CST 0000004b SystemErr R Caused by: java.language.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
------------------------------------------------------------------------------------------

It get’s confusing as Hibernate throws an error that the "object is not an instance of declaring class" when searching for the group_id from the GROUP table only on updates. I got a lot of threads online about it being a hibernate error (am using Hibernate 3.3.1). Has someone encountered the similar issue and if so how did you end up solving it?
Any input is highly apprised.



Get Source Code

  Views 44   Posted on : Saturday, May 25, 2013 7:47:07 PM
Related Tags:




Replies on "Hibernate : org.hibernate.PropertyAccessException: IllegalArgumentException" :

Nobody has replied on this post , be first to post answer.


Post Your Answer/Comment:

Please Login first to post Reply !


Note: Please Put Code into <code></code> block.




Also See: