3 Replies Latest reply on Oct 28, 2010 8:53 PM by Brian Topping

    Hibernate Tools does not support ElementCollection ?

    nimo stephan Master

      I have something like this:

       

      @ElementCollection
            @CollectionTable(
                  name="PHONE"
            )
            @Column(name="PHONE_NUMBER")
            private List<String> phones;

       

      within an entity. The Tables are all successfully generated by JPA (Hibernate).

       

      However, when opening the Hibernate Tools SessionFactory, I get this error:

       

      "Could not determine type for java.util.list for table, at table MY_TABLE, for columns: [org.hibernate.mapping.Column(PHONE_NUMBER)]"

       

       

      Does this error come from Hibernate Tools or Hibernate ? Hibernate still generates this tables without complaining. But Hibernate Tools complains.

        • 1. Re: Hibernate Tools does not support ElementCollection ?
          Denis Golovin Master

          Do you have a stacktrace for this error?

          • 2. Re: Hibernate Tools does not support ElementCollection ?
            nimo stephan Master

            Unfortunately not. There is not stacktrace when compiling and deploying the application. The ElementCollection is working.

             

            Only when opening the HQL-Editor the error comes. I go to "rebuild configuration". Then the branch of configuration, session factory and database is opened. The error is displayed in the SessionFactory branch:

             

            "<SessionFactory error: Could not determine type for java.util.list for table, at table  MY_TABLE, for columns: [org.hibernate.mapping.Column(PHONE_NUMBER)]"

            • 3. Re: Hibernate Tools does not support ElementCollection ?
              Brian Topping Newbie

              How about this one:

               

               

              Caused by: javax.persistence.PersistenceException: [PersistenceUnit: mauswerks] Unable to build EntityManagerFactory
              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
              at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
              at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
              ... 63 more
              Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: Address, for columns: [org.hibernate.mapping.Column(addressLines)]
              at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:292)
              at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
              at org.hibernate.mapping.Property.isValid(Property.java:207)
              at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
              at org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:66)
              at org.hibernate.cfg.Configuration.validate(Configuration.java:1149)
              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1334)
              at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
              ... 68 more

              Caused by: javax.persistence.PersistenceException: [PersistenceUnit: xxx] Unable to build EntityManagerFactory

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

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

              at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)

              at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)

              ... 63 more

              Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: Address, for columns: [org.hibernate.mapping.Column(addressLines)]

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

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

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

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

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

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

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

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

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

              ... 68 more