required a bean of type 'org.hibernate.SessionFactory' that could not be found

Your SessionFactory configuration is wrong. From your pom.xml I see you are using hibernate version 5, so your configuration should be:

spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext

And also you have different versions of hibernate jars in your pom.xml, try to use same versions.


For starters there are a couple of things of with your configuration

  1. Mixing jars from different Spring and Hibernate versions
  2. Too may already managed dependencies
  3. Trying to be smarter then Spring Boot.

For 1. and 2. just remove the <version> tag for spring-orm and the hibernate-core and hibernate-entitymanager manager dependencies. Spring Boot is already managing those. You can actually remove all the org.springframework dependencies those are already pulled in by the starters (and actually the hibernate ones also).

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
</dependencies>

Next in your configuration you have at least 2 SessionFactory's configured. I would suggest to use annotations to define your entities instead of hbm.xml files.

@Entity
@Table("person")
public class Employee implements Serializable{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue
    private int id;

    @Column(nullable=false)
    private String name;

    private String country;

}

When using JPA annotations Hibernate will automatically detect your entities (especially combined with Spring Boot) which makes it very powerful. Ofcourse you can now remove your Employee.hbm.xml.

Next your EmployeeDataDaoImpl I strongly suggest to use plain JPA over plain Hibernate. Generally that provides enough for you to work with.

@Repository
public class EmployeeDataDaoImpl  {


    @PersistenceContext
    private EntityManager entityManger;


    public List<Employee> findAllEmployee(){
        return em.createQuery("select e from Employee e", Employee.class).getResultList();
    }
}

With this setup you can basically completely remove your HibernateConfiguration. Yes you can as Spring Boot detects Hibernate and automatically creates a JpaTransactionManager, enables transactions and preconfigured a EntityManagerFactory.

If you really want to use plain hibernate with a SessionFactory just use a HibernateJpaSessionFactoryBean to expose the underlying SessionFactory of the EntityManagerFactory.

@Bean
public HibernateJpaSessionFactoryBean sessionFactory(EntityManagerFactory emf) {
    HibernateJpaSessionFactoryBean factory = new HibernateJpaSessionFactoryBean();
    factory.setEntityManagerFactory(emf);
    return factory;
}

However as mentioned I would strongly suggest to use plain JPA as that is a lot easier to setup and with the current state of JPA it offers almost as much of the functionality as plain Hibernate does.

Pro Tip You have a dependency on spring-boot-starter-data-jpa which means you are having a dependency on Spring Data JPA. Which would make things even easier if you would use JPA. You can remove your EmployeeDataDaoImpl and just create an interface and use that.

public interface EmployeeRepository extends JpaRepository<Employee, Long> {}

That is it, all the CRUD methods (findOne, findAll, save etc.) are provided for you without you having to create an implementation.