org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.MappingException: class demo.fabric.Employee not found while looking for property: id

Stack Overflow | Anders Johansson | 10 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Trouble getting started with gradle springboot and postgresql

    Stack Overflow | 10 months ago | Anders Johansson
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.MappingException: class demo.fabric.Employee not found while looking for property: id

    Root Cause Analysis

    1. org.hibernate.MappingException

      class demo.fabric.Employee not found while looking for property: id

      at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass()
    2. Hibernate
      SimpleValue.setTypeUsingReflection
      1. org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:212)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      2. org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:422)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      2 frames
    3. org.hibernate.boot
      MetadataBuildingProcess.complete
      1. org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindSimpleEntityIdentifier(ModelBinder.java:712)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      2. org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityIdentifier(ModelBinder.java:342)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      3. org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindRootEntity(ModelBinder.java:237)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      4. org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:184)[hibernate-core-5.0.9.Final.ja r:5.0.9.Final]
      5. org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      6. org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      7. org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
      7 frames
    4. org.hibernate.jpa
      EntityManagerFactoryBuilderImpl.build
      1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final]
      2. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final]
      2 frames
    5. Spring ORM
      AbstractEntityManagerFactoryBean.afterPropertiesSet
      1. org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)[spring-orm-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:338)[spring-orm-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      3. org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373)[spring-orm-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      4. org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362)[spring-orm-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      4 frames
    6. Spring Beans
      AbstractAutowireCapableBeanFactory.initializeBean
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2 frames