3 Replies Latest reply on Jul 22, 2003 3:01 PM by camel

    Creating a Db index on a CMP field

    camel

      Is there a way I can tell JBoss to create a database index on a CMP field?

      For example, say I have a table called USERS with two columns: id (the primary key), and "name". I would like the name column to be index. Currently, I would have to go into the database and create the index myself.

      Thanks
      Chris Lamprecht

        • 1. Re: Creating a Db index on a CMP field
          lafr

          This will be supported in 3.2.2 and XDoclet-1.2b3.
          There is an xdoclet tag called "@jboss.persistence dbindex="true"".
          This adds to the CMP-field of the entity bean in jbosscmp-jdbc.xml.

          A single field index which allows duplicate entries is created if the table is also created by jboss.

          • 2. Re: Creating a Db index on a CMP field
            camel

            Frank,
            Thank you for your reply, that is exactly what I am looking for!

            -chris

            • 3. Re: Creating a Db index on a CMP field
              camel

              I tried the new dbindex XDoclet tag, and it works for CMP fields. However, does this work on a CMR relation field? (i.e., I want a DB index on a foreign key column too). I tried adding the @jboss.persistence dbindex="true" to the CMR field xdoclet tags, but it didn't seem to generate anything new.

              Thanks,

              Chris