3 Replies Latest reply on Jan 31, 2012 3:11 PM by adamw

    ant task requires HibernateToolTask

    claudio4j

      Trying to create the audit tables. My current persistence.xml has hibernate.hbm2ddl.auto=none.

       

      I created the build.xml to export the auditable tables, but there is a error

       

      /build.xml:24: taskdef A class needed by class org.hibernate.tool.ant.EnversHibernateToolTask cannot be found: org/hibernate/tool/ant/HibernateToolTask

       

      But org/hibernate/tool/ant/HibernateToolTask class is not part of hibernate 4 at hibernate-release-4.0.0.Final/lib/required/hibernate-core-4.0.0.Final.jar

       

      I see there is org/hibernate/tool/hbm2ddl/ package, but the v is not there. I tried to use jboss-tools jar 3.4.0.CR2-SNAPSHOT but it requires class org.hibernate.util.ReflectHelper that is part of hibernate 3

      Caused by: java.lang.ClassNotFoundException: org.hibernate.util.ReflectHelper

       

      So, how to generate the envers auditable tables  with hibernate.hbm2ddl.auto=none ?

       

      To force the schema generation, hibernate.hbm2ddl.auto=create-drop, but it will drop all jpa tables from my database, and that is not desirable.

        • 1. Re: ant task requires HibernateToolTask
          adamw

          Hmm so the normal ant task also doesn't work (HibernateToolTask)? That's in fact more of a jboss tools question, where is a version compatible with hib4. Maybe you can try asking on their forum?

           

          You can always try hbm2ddl.auto=update .

           

          Adam

          • 2. Re: ant task requires HibernateToolTask
            dvankeer_

            The normal HIbernateToolTask does not exists anymore in the hibernate 4.x distribution. And it seems that the new jboss tools currently don't support envers in anyway. You can generate everything except for envers related audit tables, etc. They don't seems to have any timeline available when envers will be supported as far as i know.

             

            See: https://community.jboss.org/message/590841#590841

             

            The only way i found is to downgrade dependencies to hibernate 3, then generate everything based on hibernate 3 and it's tools and then upgrade back to hibernate 4. Which is annoying if you have any custom types, since the method signatures got altered there ;-).

             

            So if you use envers and want to change your database in the near future, my only advice is do not upgrade to hibernate 4 yet. Atleast until tool support is fixed, it saves you a lot of frustration.

            • 3. Re: ant task requires HibernateToolTask
              adamw

              Sorry to hear that.

               

              My only suggestion so far is to try to fix this yourself and contribute

               

              Adam