4 Replies Latest reply on Dec 7, 2003 1:54 PM by martin0

    cmp field mapping for float on SQL2000

    martin0 Novice

      Hi,

      I have an entity bean with a float (lower case f) field. I am using SQLServer 2000.
      The field is called poValue.
      The database field is of type real.

      I am getting the following error:
      javax.ejb.EJBException: Internal error getting results for field member poValue; CausedByException is:
      [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type.
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadArgumentResults(JDBCAbstractCMPFieldBridge.java:418)
      ....

      Originally jbosscmp-jdbc.xml was configured to use default field mappings for this field.
      For MS SQLSERVER2000 this is

      <java-type>java.lang.Float</java-type>
      <jdbc-type>REAL</jdbc-type>
      <sql-type>REAL</sql-type>


      (Not sure if java.lang.Float would be used for primitive float type?)

      I also tried explicit mapping in local jbosscmp-jdbc.xml:
      <cmp-field>
      <field-name>poValue</field-name>
      <jdbc-type>REAL</jdbc-type>
      <sql-type>REAL</sql-type>
      </cmp-field>

      This gave the same errors.

      Can anyone tell me the solution to this problem?

      Many Thanks
      Martin