3 Replies Latest reply on Jun 28, 2013 8:14 AM by Dirk Weinhardt

    MappingException "Could not determine type for: pg-uuid" Thrown When Opening Session Factory

    Dirk Weinhardt Newbie

      Hi Community,

       

      I am trying to use Hibernate Tools within Eclipse (Eclipse Juno Service Release 2 on Windows 7 x64, PostgreSQL 9.2 on Debian 6). I was able to set up a Hibernate Configuration. All my data objects are listed under the Configuration node as well as the database can be browsed under the Database node. But a MappingException is thrown for a pg-uuid ID column when trying to open a Session Factory.

       

      Error Message: org.hibernate.MappingException: Could not determine type for: pg-uuid, at table: roles, for columns: [org.hibernate.mapping.Column(id)]

       

      The affected ID property of the roles entity is defined as:

       

                @Id

                @Type(type = "pg-uuid")

                @GeneratedValue(generator="hibernate-uuid")

                @GenericGenerator(name="hibernate-uuid", strategy="uuid2")

                protected UUID id;

       

      We are not experiencing this issue when using the class and configuration with Hibernate 4.1.8 in a Spring MVC application.

       

      What could we be doing wrong? Is any additional information required to understand this issue? Would this problem better be reported as a bug to the Hibernate Tools team?

       

      Any help is highly appreciated.

       

      Thank you,


      Dirk

       

       

       

       

      Full Stack Trace;

       

      org.hibernate.MappingException: Could not determine type for: pg-uuid, at table: roles, for columns: [org.hibernate.mapping.Column(id)]

                at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:291)

                at org.hibernate.cfg.Configuration$1.getIdentifierType(Configuration.java:2217)

                at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:553)

                at org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:578)

                at org.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:120)

                at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:275)

                at org.hibernate.mapping.ToOne.isValid(ToOne.java:105)

                at org.hibernate.mapping.Property.isValid(Property.java:217)

                at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)

                at org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:66)

                at org.hibernate.cfg.Configuration.validate(Configuration.java:1193)

                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1378)

                at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)

                at org.hibernate.console.ConsoleConfiguration$5.execute(ConsoleConfiguration.java:278)

                at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)

                at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)

                at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:273)

                at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:43)

                at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)

                at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)

                at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)

                at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

        • 1. Re: MappingException "Could not determine type for: pg-uuid" Thrown When Opening Session Factory
          Dirk Weinhardt Newbie

          Adding a

           

          <typedef class="org.hibernate.type.PostgresUUIDType" name="pg-uuid" />

           

          type definition to the Hibernate Configuration causes an AbstractMethodError to be thrown when attempting to open a session factory.

           

          Full Stack Trace:

           

          java.lang.AbstractMethodError

                    at org.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:120)

                    at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:275)

                    at org.hibernate.mapping.ToOne.isValid(ToOne.java:105)

                    at org.hibernate.mapping.Property.isValid(Property.java:217)

                    at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)

                    at org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:66)

                    at org.hibernate.cfg.Configuration.validate(Configuration.java:1193)

                    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1378)

                    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)

                    at org.hibernate.console.ConsoleConfiguration$5.execute(ConsoleConfiguration.java:278)

                    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)

                    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)

                    at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:273)

                    at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:43)

                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)

                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)

                    at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)

                    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

          • 2. Re: MappingException "Could not determine type for: pg-uuid" Thrown When Opening Session Factory
            Max Rydahl Andersen Master

            Might be that Hibernate 4.1.x changed apis for types :/

             

            Does it work if you use Hibernate 4.0 jars in your project instead ?

            • 3. Re: MappingException "Could not determine type for: pg-uuid" Thrown When Opening Session Factory
              Dirk Weinhardt Newbie

              I have build the project against Hibernate 4.0.0.Final (hibernate-entitymanager Maven dependency) now and still experience the exact same errors as above. Any ideas?

               

              Regards,


              Dirk