3 Replies Latest reply on Aug 27, 2006 12:59 AM by knifegun

    Hibernate 3.0 and Cactus JUnits

    ssanjeev

      We are having an issue when we run Cactus JUnits on JBoss 4.0.2 with Hibernate 3.0. A brief description is:
      We have

      Network extends Persistent and Persistent has private OID id;


      The mapping for Network looks like:
      <id name="id" type="com.xxx.common.hibernate.OIDType" unsaved-value="null" >
       <column name="network_id" sql-type="bytea" not-null="true"/>
       <generator class="com.xxx.common.hibernate.OIDGenerator"/>
       </id>


      With this setup - we are getting the following error:
      2005-09-30 00:30:15,535 ERROR [com.xxx.configmgr.server.persist.deviceinterface.InterfaceTest] (http-0.0.0.0-8881-4) HibernateException:
      org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.xxx.configmgr.server.persist.common.Persistent.id
       at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:119)
       at org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:103)
       at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2925)
       at org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2691)
       at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
       at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:408)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:82)
      ....
      ....
      Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@c8e2a4
       at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:105)
       ... 50 more
      
      


      Does anyone know what is wrong with this setup - this was not the case with Hibernate 2.1.4. Also this works fine when I use App server from our client. It is just the JUnit route which is trying to cast Network to Persistent or something and giving a class cast exception.

      Thanks

      Sanjeev