title: Error in starting application created in spring boot with JPA and mysql
body: <p>I was developing a simple spring boot application that fetches and inserts data to a database i created using MySql workbench. I keep getting the error below.</p>
  
  <pre>
  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2018-09-14 11:35:14.282 ERROR 11268 --- [           main] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.MappingException: class demo.fabric.Employee not found while looking for property: id
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
      at com.example.studentInfo.StudentOnlineInfoApplication.main(StudentOnlineInfoApplication.java:10) [classes/:na]
  Caused by: org.hibernate.MappingException: class demo.fabric.Employee not found while looking for property: id
      at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:220) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:482) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindSimpleEntityIdentifier(ModelBinder.java:726) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityIdentifier(ModelBinder.java:350) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindRootEntity(ModelBinder.java:245) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:192) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:861) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:888) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
      ... 16 common frames omitted
  Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [demo.fabric.Employee]
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:348) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:216) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      ... 33 common frames omitted
  Caused by: java.lang.ClassNotFoundException: Could not load requested class : demo.fabric.Employee
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:336) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161]
      at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161]
      at java.lang.Class.forName0(Native Method) ~[na:1.8.0_161]
      at java.lang.Class.forName(Unknown Source) ~[na:1.8.0_161]
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:345) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
      ... 34 common frames omitted</pre>
  
  <p>Below is my POM.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.example.studentInfo&lt;/groupId&gt;
  &lt;artifactId&gt;studentOnlineInfo&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;name&gt;studentOnlineInfo&lt;/name&gt;
  &lt;description&gt;A web project which implements simple write and read to the database&lt;/description&gt;
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.0.5.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Here is my application.properties file</p>
  
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/studentInfo
  spring.datasource.username=root
  spring.datasource.password=Christensen001
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.jpa.show-sql=true
  spring.mvc.view.prefix=/WEB-INF/jsps/
  spring.mvc.view.suffix=.jsp
  </code></pre>
  
  <p>This is my Entity class</p>
  
  <pre><code>package com.example.studentInfo.entities;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  @Entity
  @Table(name="studenData")
  public class StudentInformation {
  @Id
  private long id;
  @Column(name="sreg_num")
  private String reg_num;
  @Column(name="semail")
  private String email;
  @Column(name="sname")
  private String name;
  @Column(name="sage")
  private int age;
  @Column(name="sstate")
  private String state;
  @Column(name="scity")
  private String city;
  public long getId() {
      return id;
  }
  public void setId(long id) {
      this.id = id;
  }
  public String getReg_num() {
      return reg_num;
  }
  public void setReg_num(String reg_num) {
      this.reg_num = reg_num;
  }
  public String getEmail() {
      return email;
  }
  public void setEmail(String email) {
      this.email = email;
  }
  public String getName() {
      return name;
  }
  public void setName(String name) {
      this.name = name;
  }
  public int getAge() {
      return age;
  }
  public void setAge(int age) {
      this.age = age;
  }
  public String getState() {
      return state;
  }
  public void setState(String state) {
      this.state = state;
  }
  public String getCity() {
      return city;
  }
  public void setCity(String city) {
      this.city = city;
  }
  public StudentInformation(long id, String reg_num, String email, String name, int age, String state, String city) {
      super();
      this.id = id;
      this.reg_num = reg_num;
      this.email = email;
      this.name = name;
      this.age = age;
      this.state = state;
      this.city = city;
  }
  @Override
  public String toString() {
      return "StudentInformation [id=" + id + ", reg_num=" + reg_num + ", email=" + email + ", name=" + name
              + ", age=" + age + ", state=" + state + ", city=" + city + "]";
  }
  } &lt;/pre&gt;
  </code></pre>
  
  <p>studentInfoApplication.java</p>
  
  <pre><code>package com.example.studentInfo;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class StudentOnlineInfoApplication {
  
  public static void main(String[] args) {
      SpringApplication.run(StudentOnlineInfoApplication.class, args);
  }
  }
  </code></pre>
  
  <p>How do i resolve this?</p>