0 Replies Latest reply on May 26, 2003 5:03 AM by rgucci

    Sybase NUMERIC fields getting rounded

    rgucci

      Hi,

      We are having a problem with inserting values into a NUMERIC field in Sybase using CMP.

      The entity bean's field is defined as BigDecimal.
      The Sybase table field is defined as NUMERIC(18,4).

      In jaws.xml, a type mapping is defined for the bigdecimal field as

      <cmp-field>
      <field-name>homeAmt</field-name>
      <column-name>home_amt</column-name>
      <java-type>java.math.BigDecimal</java-type>
      <jdbc-type>DECIMAL</jdbc-type>
      <sql-type>NUMERIC(18,4)</sql-type>
      </cmp-field>

      We define the mapping in jaws.xml instead of standardjaws.xml because changing standardjaws doesnt seem to have any effect and still uses the mapping for IMAGE instead of NUMERIC.

      When inserting a value with a decimal part, such as new BigDecimal("1234.123"), the value stored in the database is just the integer part (1234).

      Are we using the correct type mapping?

      JBoss version is 2.4.10.