2 Replies Latest reply on Jan 29, 2005 12:05 PM by starksm64

    CMP BigDecimal to zero decimal numeric field

    tsangcn

      Hello,

      I am using JBoss 4.0.0 with Jaybird 1.5.5. My database is Firebird 1.5.1

      My table has a zero decimal numeric field defined as NUMERIC(15,0)

      A CMP 2.0 entity EJB is defined on the table.
      The field is defined as java.math.BigDecimal.

      A record is created using the entity bean with no problem.

      But when I get the field from the entity bean, it fails with the following exception

      Caused by: javax.ejb.TransactionRolledbackLocalException: Internal error getting results for field member amount; CausedByException is:
      Got a java.lang.Long[cl=0, value=550240] while looking for a java.math.BigDecimal[cl=24384712]; CausedByException is:
      Internal error getting results for field member amount; CausedByException is:
      Got a java.lang.Long[cl=0, value=550240] while looking for a java.math.BigDecimal[cl=24384712]
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:232)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:316)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:149)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
      at org.jboss.ejb.Container.invoke(Container.java:854)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
      at $Proxy425.getExpenseReportPostingVO(Unknown Source)
      at com.nsl.expenseReport.expenseReport.beans.ExpenseReportPostingExporter.export(ExpenseReportPostingExporter.java:63)
      ... 87 more

      The problem also occurs in JBoss 4.0.1

      Any help is appreciated.
      Thanks.
      C. N.

        • 1. Re: CMP BigDecimal to zero decimal numeric field
          tsangcn

          OK. I got good hints from the Firebird-java forum although this is a JBoss issue. It seems that none in this forum can help me.

          Add the following under the type-mapping Firebird in $JBOSS_HOME/server/default/conf/standardjbosscmp-jdbc.xml

          <mapping>
           <java-type>java.math.BigDecimal</java-type>
           <jdbc-type>NUMERIC</jdbc-type>
           <sql-type>NUMERIC</sql-type>
          </mapping>


          Hope this can be valuable to others.

          Thanks
          C. N.

          • 2. Re: CMP BigDecimal to zero decimal numeric field
            starksm64

            Type mapping is specific to the database driver, not jboss. We don't use firebird so maintence of its type mapping is up to the user community. For this to be useful you need to create a patch case in jira with the change details including the firebird driver version.

            http://jira.jboss.com/jira/browse/JBAS