6 Replies Latest reply on Nov 14, 2002 4:12 PM by lei.liu

    Which Data Type should I use to map a XMLType column of a ta

    lei.liu

      Hello, together,

      I have a question to some experts here :-)
      I am trying to write a CMP EJB, which should map a table of Oracle9i. There is a XMLType column in this table. Does somebody have an idea, which java type should I use for the corresponding field in the EJB? Or should I also make some changes in the standardjbosscmp-jdbc.xml file?

      Thanks a lot!!!
      best regards
      Lei

        • 1. Re: Which Data Type should I use to map a XMLType column of
          scoy

          Oracle 9i stores XMLType as CLOB, so you could use jdbc and sql type mappings of "CLOB" (be sure to use JBoss 3.0.4 or newer AND the Oracle "oci" JDBC drivers for this to work properly).

          However, this will only give you access to the raw data (which may be the XML text, but I don't know). If you want to exploit Oracle's XML capabilities, you will probably need to use BMP.

          Steve

          • 2. Re: Which Data Type should I use to map a XMLType column of
            rakn

            Hi,

            I'm using Oracle 9.2i and for storing a xml files a use CLOB.
            Hovewer I'd not change anything in the file standardjbosscmp-jdbc.xml because this is for having a standard mapping. Instead I use a jbosscmp-jdbc.xml (\META-INF) for a customized mapping.

            • 3. Re: Which Data Type should I use to map a XMLType column of
              lei.liu

              thanks a lot :-)

              yours
              lei

              • 4. Re: Which Data Type should I use to map a XMLType column of
                lei.liu

                >Oracle 9i stores XMLType as CLOB, so you could use jdbc
                >and sql type mappings of "CLOB" (be sure to use JBoss
                >3.0.4 or newer AND the Oracle "oci" JDBC drivers for
                >this to work properly).

                >However, this will only give you access to the raw data
                >(which may be the XML text, but I don't know). If you
                >want to exploit Oracle's XML capabilities, you will
                >probably need to use BMP.

                >Steve

                Hi, Steve,
                Thanks a lot for your help!

                another question for you, what is the Oracle "oci" JDBC Drivers, is it not the standard JDBC Driver, that one can find on the Oracle Homepage?

                I have also tried to map the XMLType using sql type mapping of "CLOB", but it seems not to work properly. Althrough I can add an entry in DB, but by the findByPrimaryKey(...) method I get only a null value for the XMLType value.

                Sorry for so many questions, I am a newbie here :-)

                Thanks a lot!

                yours
                Lei

                • 5. Re: Which Data Type should I use to map a XMLType column of
                  scoy

                  Please read the "Map Java byte[] to database BLOB ?" thread.

                  Most of the answers are there.

                  Are you using JBoss 3.0.4? LOB support in general was problematical in earlier releases.

                  Steve

                  • 6. Re: Which Data Type should I use to map a XMLType column of
                    lei.liu

                    yes, I got it.
                    thanx a lot again :-)

                    best regards
                    Lei