0 Replies Latest reply on Nov 2, 2001 8:19 AM by Torben Jaeger

    Load failed

    Torben Jaeger Newbie

      System:
      JBoss 2.4.3
      MS SQL 2000 (Sprinta JDBC Driver)

      using standardjaws.xml definitions of MS SQLSERVER 2000

      <java-type>java.lang.Long</java-type>
      <jdbc-type>BIGINT</jdbc-type>
      <sql-type>BIGINT</sql-type>


      Following Error occurs


      [Beschaffer] setting field --> data.bestellObligo2
      [Beschaffer] datafield of type class java.lang.Long --> value of type class java
      .math.BigDecimal
      [Beschaffer] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception is:
      java.lang.IllegalArgumentException: field type mismatch; nested exceptio
      n is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.IllegalArgumentException: field type mismatch
      [Beschaffer] java.rmi.ServerException: Load failed; nested exception is:
      [Beschaffer] java.lang.IllegalArgumentException: field type mismatch
      [Beschaffer] java.lang.IllegalArgumentException: field type mismatch
      [Beschaffer] at java.lang.reflect.Field.set(Native Method)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.metadata.CMPFieldMetaData.set(CMPF
      ieldMetaData.java:347)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPFieldValue(
      JDBCCommand.java:650)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOne
      Entity(JDBCLoadEntityCommand.java:217)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleR
      esult(JDBCLoadEntityCommand.java:176)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeState
      mentAndHandleResult(JDBCQueryCommand.java:59)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCC
      ommand.java:160)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute
      (JDBCLoadEntityCommand.java:147)
      [Beschaffer] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(
      JAWSPersistenceManager.java:156)
      [Beschaffer] at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPer
      sistenceManager.java:362)
      [Beschaffer] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke
      (EntitySynchronizationInterceptor.java:286)
      [Beschaffer] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(Entity
      InstanceInterceptor.java:208)
      [Beschaffer] at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLock
      Interceptor.java:136)
      [Beschaffer] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercept
      orCMT.java:133)
      [Beschaffer] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Tx
      InterceptorCMT.java:307)
      [Beschaffer] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCM
      T.java:99)
      [Beschaffer] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInte
      rceptor.java:128)
      [Beschaffer] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.ja
      va:195)
      [Beschaffer] at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:427
      )
      [Beschaffer] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke
      (JRMPContainerInvoker.java:489)
      [Beschaffer] at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeCont
      ainer(GenericProxy.java:335)
      [Beschaffer] at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(Enti
      tyProxy.java:133)
      [Beschaffer] at $Proxy140.getBeschafferData(Unknown Source)


      A dirty hack in CMPFieldMetaData.set(Object instance, , Object value) before setting the actual value fixes this error:


      if (value instanceof java.math.BigDecimal && dataField.getType() == Long.class) {
      value = new Long(((java.math.BigDecimal)value).longValue());
      }
      dataField.set(currentObject, value);

      But this can't be the desired solution.

      Finally the question:
      How could the type java.math.BigDecimal be retrieved although the type of this field is bigint at database level?

      Any ideas?

      Torben