One to Many mapping not working Spring data JPA
<p>I am using Spring data JPA for persistence and have configured Spring via annotation.</p>

<p>1)Spring configuration class</p>

<pre><code>package com.karthik.config;

import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.karthik")
@EnableJpaRepositories("com.karthik.repository")
public class AppConfig {

    private static final Logger logger = Logger.getLogger(AppConfig.class);

    @Bean
    public DataSource dataSource() {
        BasicDataSource dataSource = new org.apache.commons.dbcp.BasicDataSource();
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource.setUrl("**********");
        dataSource.setUsername("******");
        dataSource.setPassword("*****");
        logger.info("DATA SOURCE CONFIGURED");
        return dataSource;
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {
        LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
        lef.setDataSource(dataSource);
        lef.setJpaVendorAdapter(jpaVendorAdapter);
        lef.setPackagesToScan("com.karthik");
        return lef;
    }

    @Bean
    public JpaVendorAdapter jpaVendorAdapter() {
        HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
        hibernateJpaVendorAdapter.setShowSql(true);
        hibernateJpaVendorAdapter.setGenerateDdl(true);
        hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
        return hibernateJpaVendorAdapter;
    }

    @Bean
    public PlatformTransactionManager transactionManager() {
        return new JpaTransactionManager();
    }
}
</code></pre>

<p>2) Entity classes</p>

<p>There is <strong>one to many mapping between hotel and rooms</strong></p>

<p>HotelEntity  </p>

<pre><code>package com.karthik.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="hotels")
public class HotelEntity {

    @Id
    @GeneratedValue
    @Column(name="mh_id")
    private Long id;

    @Column(name="mh_name", length=100, nullable=false)
    private String name;

    @Column(name="mh_description", length=500, nullable=false)
    private String description;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="mh__created_on", nullable=false)
    private Date createdOn;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "hotelId")
    private Set&lt;RoomEntity&gt; rooms = new HashSet&lt;&gt;(0);

    public HotelEntity(){
    }

    //field getters and setters
}
</code></pre>

<p>RoomEntity</p>

<pre><code>package com.karthik.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="rooms")
public class RoomEntity {

    @Id
    @GeneratedValue
    @Column(name="mr_id")
    private Long id;

    @Column(name="mr_code", length=50)
    private String code;

    @Column(name="mr_roomtype_name", nullable=false, length=50)
    private String roomType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "mr__hotelId", nullable = false)
    private Integer hotelId;

    public RoomEntity() {
    }

    //field getters and setters
}
</code></pre>

<p>pom.xml</p>

<pre><code>&lt;dependency&gt;
            &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
            &lt;version&gt;${springframework.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
            &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
            &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
            &lt;version&gt;3.0.1&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
            &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
            &lt;version&gt;1.4.1.RELEASE&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
            &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
            &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
            &lt;version&gt;4.3.8.Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
            &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
            &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
            &lt;version&gt;1.2.2&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
            &lt;groupId&gt;mysql&lt;/groupId&gt;
            &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
            &lt;version&gt;5.1.27&lt;/version&gt;
    &lt;/dependency&gt;
</code></pre>

<p>The above code works fine when there is no mapping between hotel and room entities. 
But when mapping is added, there is error at the time of deployment itself. Below is the error I see in the console :</p>

<pre><code>Nov 25, 2016 8:09:08 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Nov 25, 2016 8:09:08 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/services] startup failed due to previous errors
</code></pre>

<p>I do not see the any exception/root cause of error in the console which is making it difficult to debug. I just see one WARN message on the console :</p>

<pre><code>WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
Nov 25, 2016 7:53:34 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
</code></pre>

<p>1) What is wrong in the mapping that causing the above error? <br>
2) How to capture the error/exception stack trace on console?<br>
3) What does the deprecation message mean? How to change/update the persistence provider?<br>
4) Do I need to use different data source(Currently using DBCP data source) to support mappings? </p>

<p>Please answer all the above questions.</p>