| 
					
						 Hi everyone!
 
 I've been looking at hibernate to improve productivity - ie. less SQL code. I'm newbie and can't find the cause of a seemingly very simple exception.
 
 I'm trying to persist an object that represents a [Page] in a web site. Each page has various people working on it the Role class and each [role] is associated with 0 or more [User]. I'm using ANT to automate the generation of the Objects Page, Role and User etc everything seemed fine until I tried to 'save' the PageRoleUser(s). I get the stack trace below. Has anyone else seen this find of stacktrace and know what I could be looking for? I've scanned through this forum and google but can find anything close to this. Any help appreciated. If I do find a solution myself will post to help anyone else that falls into this problem...
 
 I just don't seem to understand why hibernate throws the IllegalArgumentException on a getter method
 
 Thanks
 
 
 Hibernate version: 2 
 
 Mapping documents:
  --- PageRole.hbm.xml ---
  <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"           "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
  <hibernate-mapping>
    <class name="dsys.prototype.cms.wmt.gen.PageRole" table="wmt_PAGE_ROLE" lazy="false">
  	<id name="id" type="int" column="ROLE_ID">       <meta attribute="scope-set">protected</meta> 		<generator class="native"/> 	</id> 			
      <property name="title" type="string">       <meta attribute="use-in-tostring">true</meta>       <column name="TITLE" not-null="true" index="ROLE_TITLE"/>     </property>          <property name="narrative" type="string" column="NARRATIVE">     </property>      	<set name="pages" table="wmt_PAGE_ROLES" lazy="false"> 		<key column="ROLE_ID"></key> 		<many-to-many class="dsys.prototype.cms.wmt.gen.Page" column="PAGE_ID"/> 	</set>
  		 <!--		 	<set name="users" table="wmt_PAGE_ROLE_USERS" lazy="false" inverse="false" > 		<key column="ROLE_ID" /> 		<many-to-many class="dsys.prototype.cms.wmt.gen.User" column="user_id"/> 	</set> //-->
  	<list name="users" table="wmt_PAGE_ROLE_USERS" lazy="false" > 		<key column="ROLE_ID"></key> 		<index column="POSITION"></index> 		<!--<element type=""></element>//--> 		<composite-element class="dsys.prototype.cms.wmt.gen.PageRoleUser" > 			<many-to-one class="dsys.prototype.cms.wmt.gen.User" name="user"> 				<meta attribute="use-in-string">true</meta> 				<column name="user_id"/> 			</many-to-one> 			<property name="narrative" type="string" length="500"/> 			<property name="narrative2" type="string" length="500"/> 			 		</composite-element> 	</list> 		 		 	</class>         </hibernate-mapping>
  -- user.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"           "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
  <hibernate-mapping>
    <class name="dsys.prototype.cms.wmt.gen.User" table="users_TMP" lazy="false" mutable="false">       <meta attribute="class-description">@author P Black</meta>
      <id name="id" type="int" column="user_id">       <meta attribute="scope-set">protected</meta>       <generator class="assigned"/>     </id>
      <property name="name" column="name" type="string" update="false"/>     <property name="jobTitle" type="string" column="job_title" update="false"/>     <property name="department" type="string" column="department" update="false" />     <property name="email" type="string" column="email" update="false" />     <property name="userType" type="int" column="user_type" update="false" />     </class>   </hibernate-mapping>
 
  
 
 Code between sessionFactory.openSession() and session.close():
      try {
        sess = getSession();
        tx = sess.beginTransaction();
        for(Iterator iter = aPage.getRoles().iterator();iter.hasNext();) {         PageRole aRole = (PageRole) iter.next();
          sess.saveOrUpdate(aRole);
          if(aRole.getUsers()!=null) {           // new bit here           for(Iterator loop = aRole.getUsers().iterator();loop.hasNext();) {             User aUser = (User) loop.next();             sess.saveOrUpdate(aUser);           }
          }
        }       sess.saveOrUpdate(aPage);       sess.flush();       tx.commit();       success = true;     }     catch(Exception e) {       e.printStackTrace();       rollback(tx);     }     finally {       closeSession(sess);     }
  
 
 Full stack trace of any exception that occurs:
 
 09:50:52,265 ERROR BasicPropertyAccessor:106 - IllegalArgumentException in class
 : dsys.prototype.cms.wmt.gen.PageRoleUser, getter method of property: user
 09:50:52,281 ERROR SessionImpl:2379 - Could not synchronize database state with
 session
 net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred call
 ing getter of dsys.prototype.cms.wmt.gen.PageRoleUser.user
         at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(Basic
 PropertyAccessor.java:110)
         at net.sf.hibernate.type.ComponentType.getPropertyValue(ComponentType.ja
 va:179)
         at net.sf.hibernate.type.ComponentType.getPropertyValues(ComponentType.j
 ava:205)
         at net.sf.hibernate.type.ComponentType.nullSafeGetValues(ComponentType.j
 ava:164)
         at net.sf.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:15
 1)
         at net.sf.hibernate.collection.AbstractCollectionPersister.writeElement(
 AbstractCollectionPersister.java:384)
         at net.sf.hibernate.collection.List.writeTo(List.java:299)
         at net.sf.hibernate.collection.AbstractCollectionPersister.insertRows(Ab
 stractCollectionPersister.java:607)
         at net.sf.hibernate.impl.ScheduledCollectionUpdate.execute(ScheduledColl
 ectionUpdate.java:49)
         at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2418)
         at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2374)
         at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240)
         at dsys.prototype.cms.wmt.dao.WMTDAO.updatePage(WMTDAO.java:272)
         at dsys.prototype.cms.wmt.rmi.WMTServer.updatePage(WMTServer.java:147)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
 java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
 sorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
 60)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
 .java:701)
         at java.lang.Thread.run(Thread.java:534)
 Caused by: java.lang.IllegalArgumentException: object is not an instance of decl
 aring class
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
 java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
 sorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(Basic
 PropertyAccessor.java:96)
         ... 24 more
 
 Name and version of the database you are using: MS SQL Server 2k
 
 The generated SQL (show_sql=true):
 
 Debug level Hibernate log excerpt: 
											 _________________ PB~
					
  
						
					 |