title: Spring Boot - "Error creating bean with name 'entityManagerFactory'" - Start
body: <p>I have seen a lot of questions but the answers are not satisfying my problem...
  I start with Spring Boot and I am completely lost.</p>
  
  <p>The error is : </p>
  
  <pre><code>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.AnnotationException: No identifier specified for entity: pack.datas.entities.Degree
  </code></pre>
  
  <p>/// others lines</p>
  
  <pre><code>Caused by: org.hibernate.AnnotationException: No identifier specified for entity: pack.datas.entities.Degree
  </code></pre>
  
  <hr>
  
  <p><strong>The entry point :</strong> </p>
  
  <pre><code>package pack;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.domain.EntityScan;
  import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;
  
  @SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
  @RestController
  @EntityScan
  public class CandidatesRecruitmentApplication {
  
  
  
      public static void main(String[] args) {
          SpringApplication.run(CandidatesRecruitmentApplication.class, args);
      }
  }
  </code></pre>
  
  <p><strong>The classes :</strong> </p>
  
  <pre><code>package pack.datas;
  
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.sql.DataSource;
  
  import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder;
  import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
  import org.springframework.boot.context.properties.ConfigurationProperties;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  import org.springframework.jdbc.datasource.DriverManagerDataSource;
  import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
  import org.springframework.stereotype.Component;
  
  @Component
  @Configuration
  @EnableJpaRepositories
  public class DatasFactory {
  
      private DataSource dataSource;
  
      public DatasFactory() {
          super();
      }
  
      @Bean
      @ConfigurationProperties(prefix="spring.datasource")
      public DataSource dataSource() {
          if(this.dataSource == null)
              return this.dataSource = DataSourceBuilder.create().build();
          else
              return this.dataSource;
      }
  </code></pre>
  
  <hr>
  
  <pre><code>package pack.datas.entities;
  
  import java.io.Serializable;
  
  import javax.persistence.Basic;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Table;
  
  import org.springframework.data.annotation.Id;
  
  @Entity
  @Table(name = "degree")
  public class Degree implements Serializable {
  
      private static final long serialVersionUID = -8900492704842756948L;
  
      @Id
      @GeneratedValue
      @Column(name = "pk_id")
      private Integer id;
  
      @Column(name = "degree_i")
      private Integer degreeId;
  
      @Column(name = "degree_s_en")
      private String degreeEn;
  
      @Column(name = "degree_s_fr")
      private String degreeFr;
  
      protected Degree() {
      }
  
      public Degree(Integer id, Integer degreeId, String degreeEn, String degreeFr) {
          super();
          this.id = id;
          this.degreeId = degreeId;
          this.degreeEn = degreeEn;
          this.degreeFr = degreeFr;
      }
  
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      public Integer getDegreeId() {
          return degreeId;
      }
  
      public void setDegreeId(Integer degreeId) {
          this.degreeId = degreeId;
      }
  
      public String getDegreeEn() {
          return degreeEn;
      }
  
      public void setDegreeEn(String degreeEn) {
          this.degreeEn = degreeEn;
      }
  
      public String getDegreeFr() {
          return degreeFr;
      }
  
      public void setDegreeFr(String degreeFr) {
          this.degreeFr = degreeFr;
      }
  
      @Override
      public int hashCode() {
          final int prime = 31;
          int result = 1;
          result = prime * result + ((id == null) ? 0 : id.hashCode());
          result = prime * result + ((degreeEn == null) ? 0 : degreeEn.hashCode());
          result = prime * result + ((degreeFr == null) ? 0 : degreeFr.hashCode());
          result = prime * result + ((degreeId == null) ? 0 : degreeId.hashCode());
          return result;
      }
  
      @Override
      public boolean equals(Object obj) {
          if (this == obj)
              return true;
          if (obj == null)
              return false;
          if (getClass() != obj.getClass())
              return false;
          Degree other = (Degree) obj;
          if (id == null) {
              if (other.id != null)
                  return false;
          } else if (!id.equals(other.id))
              return false;
          if (degreeEn == null) {
              if (other.degreeEn != null)
                  return false;
          } else if (!degreeEn.equals(other.degreeEn))
              return false;
          if (degreeFr == null) {
              if (other.degreeFr != null)
                  return false;
          } else if (!degreeFr.equals(other.degreeFr))
              return false;
          if (degreeId == null) {
              if (other.degreeId != null)
                  return false;
          } else if (!degreeId.equals(other.degreeId))
              return false;
          return true;
      }
  
      @Override
      public String toString() {
          return "Degree [ " + degreeId + " - " + degreeEn + "/" + degreeFr + " ]";
      }
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>package pack.datas.controller;
  
  import org.springframework.transaction.annotation.Transactional;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.ResponseBody;
  
  @Controller
  public class DaoController {
  
      @GetMapping("/")
      @ResponseBody
      @Transactional(readOnly = true)
      String home() {
          return "&lt;h1&gt;Test Program&lt;/h1&gt;";
      }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>The pom.xml :</strong> </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;pack&lt;/groupId&gt;
      &lt;artifactId&gt;candidates-recruitment&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;candidates-recruitment&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&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;1.4.2.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.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-sleuth&lt;/artifactId&gt;
          &lt;/dependency&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-security&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;!-- https://mvnrepository.com/artifact/junit/junit --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&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;!-- https://mvnrepository.com/artifact/org.apache.maven.surefire/surefire-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt;
              &lt;artifactId&gt;surefire-api&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
                  &lt;version&gt;Camden.SR3&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&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;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;name&gt;Spring Releases&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;org.jboss.repository.releases&lt;/id&gt;
              &lt;name&gt;JBoss Maven Release Repository&lt;/name&gt;
              &lt;url&gt;https://repository.jboss.org/nexus/content/repositories/releases&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;name&gt;Spring Releases&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>The application.yml :</strong> </p>
  
  <pre><code># DATASOURCE (DataSourceProperties)
  spring:
    datasource:
      url: jdbc:postgresql://localhost:5432/recruitments_db
      username: postgresql
      password: postgresql
      driver-class-name: org.postgresql.Driver
  
  # HIBERNATE (HibernateProperties)
  hibernate:
    dialect: org.hibernate.dialect.PostgreSQLDialect
    show_sql: true
    hbm2ddl.auto: create
  
  #SECURITY (SecuriyProperties)
  security:
    user:
      name: TestU
      password: Test1
  </code></pre>
  
  <p>Please, I need your help !</p>