1 Reply Latest reply on Sep 23, 2003 1:00 PM by Arnold Hahamyan

    CMP CLOB field throws SQLException in 3.2.1

    Mark Frost Newbie

      I am trying to use a Clob field in my CMP Entity Bean (Oracle 8.1.7.4). I get the following exception as soon as I try to find an entity that has the clob field populated:

      java.sql.SQLException: Got a java.lang.String[cl=0, value=abcdefghijklmnopqrstuvwxyz] while looking for a java.sql.Clob[cl=31639617]
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.coerceToJavaType(JDBCUtil.java:588)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.getResult(JDBCUtil.java:449)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadArgumentResults(JDBCAbstractCMPFieldBridge.java:369)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadInstanceResults(JDBCAbstractCMPFieldBridge.java:322)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:190)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:83)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:632)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:614)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:386)


      I have the following configuration in jbosscmp-jdbc.xml:


      <ejb-name>XmlCompanyRW</ejb-name>
      <table-name>XML_COMPANY</table-name>

      <cmp-field>
      <field-name>cache_key</field-name>
      <column-name>CACHE_KEY</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>xml_clob</field-name>
      <column-name>XML_CLOB</column-name>
      <jdbc-type>CLOB</jdbc-type>
      <sql-type>CLOB</sql-type>
      </cmp-field>



      Why does JBoss think it is a java.lang.String?

      I notice also that standardjboss-jdbc.xml does not have a mapping for CLOBs (it does for BLOBs). Is there a reason for this. I tried putting one in but still got the same exception.

      Anyone had any success with CMP clob fields?

      Many thanks

      mark