4 Replies Latest reply on Aug 22, 2008 12:35 PM by twisgabak

    hbm2ddl ignoring @Versioned annotations?

    twisgabak

      Hi,

      I was doing some tests in an existing project using hibernate/Oracle, but I was not able to get the "versioned" table created properly. Annotated entities have their tables created properly but the Versioned table are not being created.

      I double checked the configuration for using envers with Oracle but still not getting the versioned tables created.

      I was expecting exceptions of any kinds (or logs) when running the hbm2ddl.SchemaExport, but my schema is simply generated as if no @Versioned annotation were added to my Java classes.

      Any idea?

      Thanks,
      Yanick

        • 1. Re: hbm2ddl ignoring @Versioned annotations?
          adamw

          Hello,

          are you using the EnversHibernateToolTask? (as described here: http://www.jboss.org/envers/schema.html) If yes, can you post the code/ant xml you are using to generate the schema?

          Adam

          • 2. Re: hbm2ddl ignoring @Versioned annotations?
            twisgabak

            Hi,


            I think I found the source of my error.

            There were no exception thrown caused by a typo in my persistence-unit properties. Then I had to update the hibernate jars I was using (core, commons-annotations, annotations, entitymanager) that envers required.

            • 3. Re: hbm2ddl ignoring @Versioned annotations?
              adamw

              Hello,

              so there was no exception thrown, when you would expect an exception to be thrown? What was the type? And does it work now?

              Adam

              • 4. Re: hbm2ddl ignoring @Versioned annotations?
                twisgabak

                I didnt set the "hibernate.ejb.event.post-*" properties name correctly initially, I had "org.hibernate.ejb.event.post-*" instead and this was silently ignored. That was a simple error from me, but the fact that you can put any property name/values in the persistence-unit's properties without any runtime validation/error is weak IMO, but nothing related to Envers.

                When I switched to the proper values I got some exceptions that led me to correct some version compatibility problems between Enverts and Hibernate I was using. Those exception I was expecting initially, but now I know why... ;)

                Now everything is working great. Looks like Envers integration will be very straightforward and easy in my project.