1 Reply Latest reply on Jun 5, 2006 1:19 AM by Leos Urban

    @Index and MySQL

    Salvatore Gerace Newbie

      HI,
      I use the @Index annotation (org.hibernate.annotations.Index) for create index if I set in persistence.xml:

      property name="hibernate.hbm2ddl.auto" value="create-drop"
      work!

      not work with:
      property name="hibernate.hbm2ddl.auto" value="update"

      This is a bug? Exists a solution?

      Configuration:
      jboss 4.0.4.GA, MySQL 5.0.18.

        • 1. Re: @Index and MySQL
          Leos Urban Newbie

           

          "Salvatore.Gerace" wrote:

          I use the @Index annotation (org.hibernate.annotations.Index) for create index if I set in persistence.xml:
          not work with:
          property name="hibernate.hbm2ddl.auto" value="update"
          This is a bug? Exists a solution?


          I have the same experience with Postgresql.
          But there is other question:

          Do you need it?

          In real life you typically use more SQL commands for DB creations.
          You need optimize tablespaces, specify domains, and other, server related, settings.
          Every SQL server has different setting - you cannot solve it in one EAR.

          You can use SQL script for database creation and you (or SQL admin) will run it before deploy. Or you can use small GUI application where you will create database, modify settings and with full your control create structure of database.

          And also note:
          When you use 'org.hibernate.annotations.Index' annotation then your application will work with Jboss AS (Hibernate) only because this annotation is not part of EJB3 specification.

          My mean.
          Leonell