5 Replies Latest reply on Jul 15, 2002 12:07 PM by bleupen

    Blob storing problem with CMP

    ups2000

      I am using Jboss3.0 beta 2 and Oracle 9i.
      In oracle-service xml I using thin driver and DriverClass=oracle.jdbc.driver.OracleDriver

      in jbosscmp-jdbc.xml file I defined comments as:
      <cmp-field>
      <field-name>comments</field-name>
      <column-name>comments</column-name>
      <jdbc-type>JAVA_OBJECT</jdbc-type>
      <sql-type>BLOB</sql-type>
      </cmp-field>

      when I am trying to store Blob type the following exception:
      ---
      19:13:36,078 ERROR [MyEJB] Could not create entity
      javax.ejb.EJBException: Internal error setting parameters for field comments Embedded Exception Invalid column type
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setArgumentParameters(JDBCAbstractCMPFieldBridge.java:242)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setInstanceParameters(JDBCAbstractCMPFieldBridge.java:215)
      ---
      Do I need to use different driver?
      Or what wrong with that?

      Thanks

        • 1. Re: Blob storing problem with CMP
          earlgrey

          you might want to try this thread:

          http://main.jboss.org/thread.jsp?forum=46&thread=10253


          Lars

          • 2. Re: Blob storing problem with CMP
            ups2000

            well, I read it.
            I still didnt understood if it possible to use BLOB types with CMP2. If I am using CMP2, then I just have to specify sql-type in jbosscmp-jdbc.xml of specific cmp field. What else?
            If I want t store long String as a Blob in Oracle, do I have to cast it to any specific type before call setter in etity bean?
            BTW, the exception throwed after ejbCreate(..) before ejbPostCreate(..), before I call my setBlobField(Object someField).
            Please any advise

            • 3. Re: Blob storing problem with CMP
              ahmay

              has this problem been resolved? I'm currently seeing the same problem.

              I'm using jboss3.0.0beta2, oracle 9i, and oci8 driver.

              thanks,
              --may

              • 4. Re: Blob storing problem with CMP
                earlgrey

                > has this problem been resolved? I'm currently seeing
                > the same problem.
                >

                ************************

                > well, I read it.
                > I still didnt understood if it possible to use BLOB
                > types with CMP2.

                it certainly is. however, not with (non-spec-compliant) oracle jdbc driver (since it does not support getBinaryStream() for writing into blobs).

                I now implemented blob-storing into oracle manually. But as Dain states, this is completely unreasonable.

                > If I am using CMP2, then I just have
                > to specify sql-type in jbosscmp-jdbc.xml of specific
                > cmp field. What else?

                1) do not use oracle
                2) do it manually
                3) use the patch mentioned in that other thread (you need to patch several jboss-classes, though)

                > If I want t store long String as a Blob in Oracle, do
                > I have to cast it to any specific type before call
                > setter in etity bean?

                you can explicitely declare different jdbc type mapping for the long string value.

                lars

                • 5. Re: Blob storing problem with CMP
                  bleupen

                  ups2000,

                  have you figured out how to save BLOBS in Oracle 9i?

                  b