title: Spring Boot Error 404 Not Found Hibernate
body: <p>I am new to Spring Boot and I am just trying to get/fetch data from datasource through this code :</p>
  
  <blockquote>
    <p>EmployeController.java</p>
  </blockquote>
  
  <pre><code>@RestController
  @RequestMapping("/api")
  
      public class EmployeController {
  
          @Autowired
          private EmployeService employeService;
  
          @GetMapping("/employe")
          public List&lt;Employe&gt; get(){
              return employeService.get();
          }
      }
  </code></pre>
  
  <blockquote>
    <p>Employe.java</p>
  </blockquote>
  
  <pre><code>@Entity
  @Table(name="employe")
  public class Employe {
  
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column
      private int id;
      @Column
      private String name;
      @Column
      private String gender;
      @Column
      private String department;
      @Column
      private Date dob;
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public String getGender() {
          return gender;
      }
      public void setGender(String gender) {
          this.gender = gender;
      }
      public String getDepartment() {
          return department;
      }
      public void setDepartment(String department) {
          this.department = department;
      }
      public Date getDob() {
          return dob;
      }
      public void setDob(Date dob) {
          this.dob = dob;
      }
      @Override
      public String toString() {
          return "Employe [id=" + id + ", name=" + name + ", gender=" + gender + ", department=" + department + ", dob="
                  + dob + "]";
      }
  </code></pre>
  
  <blockquote>
    <p>EmployeService.java</p>
  </blockquote>
  
  <pre><code>public interface EmployeService {
      List&lt;Employe&gt; get();
      Employe get(int id);
      void save(Employe employe);
      void delete(int id);
  }
  </code></pre>
  
  <blockquote>
    <p>EmployeServiceImplement.java</p>
  </blockquote>
  
  <pre><code>@Service
  public class EmployeServiceImplement implements EmployeService {
  
      @Autowired
      private EmployeDAO employeDAO;
  
      @Transactional
      @Override
      public List&lt;Employe&gt; get() {
          return employeDAO.get();
      }
  }
  </code></pre>
  
  <blockquote>
    <p>EmployeDAO.java</p>
  </blockquote>
  
  <pre><code>public interface EmployeDAO {
      List&lt;Employe&gt; get();
      Employe get(int id);
      void save(Employe employe);
      void delete(int id);
  }
  </code></pre>
  
  <blockquote>
    <p>EmployeDAOimplement.java</p>
  </blockquote>
  
  <pre><code>@Repository
  public class EmployeDAOImplement implements EmployeDAO {
  
      @Autowired
      private EntityManager entityManager;
  
      @Override
      public List&lt;Employe&gt; get() {
          Session currentSession = entityManager.unwrap(Session.class);
          Query&lt;Employe&gt; query = currentSession.createQuery("from Employe", Employe.class);
          List&lt;Employe&gt;list = query.getResultList();  
          return list;
      }
  }
  </code></pre>
  
  <p>I have writen all the configuration related to MySQl database into the application.properties and created a employe table into my database.  </p>
  
  <p>As i know that  Spring Data JPA is much better way to implement than this but as i m just want to begin with the same ... As running my project as Spring Boot App and then from Postman i am getting the 404 Error like this :</p>
  
  <p><a href="https://i.stack.imgur.com/X5a4w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X5a4w.png" alt="enter image description here"></a>  </p>
  
  <p>I am unable to understand why this is showing the 404 error and how to solve it.. </p>