9 Replies Latest reply on Aug 7, 2015 9:11 AM by Anton Hughes

    MappingException: Type not supported: ManyToOneType

    Jure Viski Newbie

      I am getting this error message

      org.hibernate.MappingException: Type not supported: org.hibernate.type.ManyToOneType
      


      does that meen that manytoone association is not supported?

        • 1. Re: MappingException: Type not supported: ManyToOneType
          Adam Warski Master

          No, it's supported, and should work :). What's your mapping, which version of Envers you are using, and what's the complete stacktrace?

          --
          Adam

          • 2. Re: MappingException: Type not supported: ManyToOneType
            Jure Viski Newbie

            Again my mistake it is not problem of many-to-one but problem of
            composite-id and key-many-to-one!
            I get this error when i try to create schema with hbm2ddl and this is my entity xml configuration!
            By the way i use Envers 1.1.0 and hibernate 3.2.6

            <class
             name="net.blabla.Mt04"
             table="MT04"
             >
            
             <composite-id name="comp_id" class="net.blabla.Mt04PK">
             <key-property
             name="mt04Mid"
             column="MT04_MID"
             type="java.lang.String"
             length="40"
             />
             <key-many-to-one
             name="mb05"
             class="net.blabla.Mb05"
             >
             <column name="MT04_MB05"/>
             </key-many-to-one>
             </composite-id>
            
             <property
             name="mt04Comp"
             type="java.lang.String"
             column="MT04_COMP"
             not-null="true"
             length="5"
             />
             ...
            
            


            • 3. Re: MappingException: Type not supported: ManyToOneType
              Jure Viski Newbie

               

              MappingException: Type not supported: org.hibernate.type.ManyToOneType
              Caused by:
              org.hibernate.MappingException: Type not supported: org.hibernate.type.ManyToOneType
               at org.jboss.envers.configuration.metadata.IdMetadataGenerator.addIdProperties(IdMetadataGenerator.java:65)
               at org.jboss.envers.configuration.metadata.IdMetadataGenerator.addId(IdMetadataGenerator.java:96)
               at org.jboss.envers.configuration.metadata.VersionsMetadataGenerator.generateFirstPass(VersionsMetadataGenerator.java:260)
               at org.jboss.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:84)
               at org.jboss.envers.configuration.VersionsConfiguration.<init>(VersionsConfiguration.java:80)
               at org.jboss.envers.configuration.VersionsConfiguration.getFor(VersionsConfiguration.java:93)
               at org.jboss.envers.event.VersionsEventListener.initialize(VersionsEventListener.java:192)
               at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:417)
               at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1310)
               at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
               at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
               ...
              


              • 4. Re: MappingException: Type not supported: ManyToOneType
                Jure Viski Newbie

                More INFO:

                I have created tables manually and turned off hbm2ddl to see if it's going to work but still same error!


                regards, jure

                • 5. Re: MappingException: Type not supported: ManyToOneType
                  Adam Warski Master

                  Hello,

                  The problem lies in the key-many-to-one mapping: it's not yet supported (*-to-one relations in keys). Please create a JIRA task for that.

                  --
                  Adam

                  • 6. Re: MappingException: Type not supported: ManyToOneType
                    TnT Angca Newbie

                    Hi Adam,

                     

                    Has this issue been resolved?  I'm using 3.5 Hibernate Core 3.5 and still getting this exception.  My code is best described here at https://issues.jboss.org/browse/ENVERS-76

                     

                    thanks,

                     

                    TnT

                    • 7. Re: MappingException: Type not supported: ManyToOneType
                      Adam Warski Master

                      No, I don't think so, there wasn't much interest in the issue it seems
                      Meanwhile, the Envers Jira moved to http://opensource.atlassian.com/projects/hibernate/browse/HHH (Envers component), and I don't think the issue is even there.

                       

                      Adam

                      • 8. Re: MappingException: Type not supported: ManyToOneType
                        Adam Warski Master

                        Btw. 3.5 is pretty old, would be good to update anyway probably

                         

                        Adam

                        • 9. Re: MappingException: Type not supported: ManyToOneType
                          Anton Hughes Master

                          Hi, sorry to bring up an old thread, but has this issue been fixed?

                           

                          I am getting the following using Hibernate and Envers 4.2.0.Final

                           

                          jboss.persistenceunit."app.ui.war#pu-tw": Failed to start service

                            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_85]

                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_85]

                            at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_85]

                          Caused by: javax.persistence.PersistenceException: [PersistenceUnit: pu-tw] Unable to build EntityManagerFactory

                            at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)

                            at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)

                            at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

                            at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

                            at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

                            at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                            ... 3 more

                          Caused by: org.hibernate.MappingException: Type not supported: org.hibernate.type.ManyToOneType

                            at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addIdProperties(IdMetadataGenerator.java:74)

                            at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addId(IdMetadataGenerator.java:105)

                            at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:413)

                            at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:101)

                            at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:103)

                            at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:135)

                            at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:63)

                            at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294)

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

                            at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)

                            at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

                            ... 9 more