4 Replies Latest reply on Feb 26, 2010 12:07 PM by adamw

    Envers with Postgresql - wrong schema creation

      Hi,

       

      Looks like there is a problem when using Envers with postgresql. During schema creation none of the AUD tables is created due to:

       

      * 2010-02-19 08:59:30,730 [] [main] 
        ERROR SchemaUpdate.execute():212
        Unsuccessful: create table entities.ItemsCompilation_AUD (originalId.id int8 not null, originalId.REV int4 not null, revtype int2, primary key (originalId.id, originalId.REV))
      * 2010-02-19 08:59:30,730 [] [main] 
        ERROR SchemaUpdate.execute():213
        ERROR: syntax error at or near "."

       

       

      Look like column names "originalId.id" "originalId.REV" are illegal.

       

       

      Any ideas how to solve this?

       

      TIA,

      Przemek

        • 1. Re: Envers with Postgresql - wrong schema creation
          adamw

          That's very weird, the columns aren't named "originalId.REV", but just "REV", the former is just an in-envers name. Which version of Envers, Hibernate, PostgreSQL are you using? Also, do you have any specific Hibernate and Envers configuration?

           

          Adam

          • 2. Re: Envers with Postgresql - wrong schema creation

            Hibernate 3.3.1, Envers 1.2.2, Postgres 8.3.x.

             

            Enironment: Seam-driven application on pure Tomcat 6.x, no JPA - hibernate only,  Hibernate local transactions (Spring driven), wired by Seam component. No other problems with this configuration, using annotations-driven configuration (@Enity) without any problems except this one with envers.

             

            Configuration of Envers made in hibernate.cfg using convention:

             

            <listener class="" type="post-update"> etc.

             


            Listeners work. When turning on Hibernate SQL logging I can see (writing out of the top of my head now, so <xxx> table names are just for demonstration):

             

            "insert into <MAIN_REV_TABLE>".

            and then

            "insert into <AUDITED_ENTITY_TABLE_NAME>_AUD... originalId.REV, originalId.id".

             

            but obviously got error.

            • 3. Re: Envers with Postgresql - wrong schema creation
              adamw

              That's really weird. I remember testing on postgresql and it worked fine. I can't see a reason why mysql or hsql would behave differently than postgresql. Could you create a small testcase and attach it to a jira issue?

               

              Adam

              • 4. Re: Envers with Postgresql - wrong schema creation
                adamw

                I just tested a Seam app with Envers, resource-local transactions and Postgresql 8.4 and it worked fine. Only difference is that I use JPA. Are you able to reproduce the problem with a small testcase?

                 

                Adam