I have a basic model called "Group" which has a name, a reference to its
parent (which is also a Group) and a collection of its children (which are
Groups).  I've defined the hibernate mapping like so:

  @Id 
  @GeneratedValue(strategy=GenerationType.AUTO)
  public Long getId()
  {
    return id;
  }

  @ManyToOne
  @JoinColumn(name="group_fk", nullable=true, insertable=false,
updatable=false)
  public Group getParent()
  {
    return parent;
  }

  @OneToMany(cascade = {CascadeType.ALL}, fetch=FetchType.LAZY)
  @JoinColumn(name="group_fk")
  public Collection<Group> getChildren()
  {
    return children;
  }

When I try to save a Group using my DAO I get the following exception:

org.springframework.orm.hibernate3.HibernateSystemException:
IllegalArgumentException occurred calling getter of
com.trace.model.Group.id; nested exception is
org.hibernate.PropertyAccessException: IllegalArgumentException occurred
calling getter of com.trace.model.Group.id
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException
occurred calling getter of com.trace.model.Group.id
        at
org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
....
....
....
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:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)

Any help or hints would be greatly appreciated.  Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/IllegalArgumentException-occurred-calling-getter-of-com.trace.model.Group.id-tf4741533s2369.html#a13558793
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to