Table generated by hibernate but not showing in mysql database

Hi I am working on code of book called Master Spring MVC and I am using Mysql Database instead of embeded database. In book author have used xml based configuration but I am using java based. Till here everything is working fine.

The problem I am facing is that when I am running my code in tomcat server and with the logs (hibernate logs for table generation for particular table) everything is fine but the table is getting generated in my database but not this table called historic. I have attached my code along with log which shows that table is generated:

Please not this is a multi module project and therefore webapp, database is configured separately.
1) Hibernate Log to genrerate particular table

Hibernate log for class:

create table historic (
   historic_type varchar(31) not null,
    id integer not null auto_increment,
    adj_close double precision,
    change_percent double precision,
    close double precision not null,
    from_date datetime,
    high double precision not null,
    interval varchar(255),
    low double precision not null,
    open double precision not null,
    to_date datetime,
    volume double precision not null,
    ask double precision,
    bid double precision,
    index_code varchar(255),
    stock_code varchar(255),
    primary key (id)
) engine=MyISAM

2)Database configuraton file

@Configuration
@ComponentScan("edu.zipcloud.cloudstreetmarket.core.entities")
@EnableTransactionManagement
public class JpaHibernateSpringConfig {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    public DataSource dataSource() {
        logger.info("============================[Data Source Configuration: Began]");
        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName("com.mysql.jdbc.Driver");
        ds.setUrl("jdbc:mysql://localhost/cloudstreet");
        ds.setUsername("root");
        ds.setPassword("root");

        logger.info("============================[Data Source Configuration: Ends]");
        return ds;
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean() {
        logger.info("============================[LocalContainerEntityManagerFactoryBean: Began]");
        LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
        bean.setDataSource(dataSource());
        bean.setPersistenceUnitName("jpaData");
        bean.setPackagesToScan("edu.zipcloud.cloudstreetmarket.core");
        bean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
        bean.setJpaProperties(hibernateJPAProperties());
        logger.info("===========================[LocalContainerEntityManagerFactoryBean: Ends]");
        return bean;
    }

    public Properties hibernateJPAProperties() {
        logger.info("============================[hibernateJPAProperties: Began]");
        Properties properties = new Properties();
        properties.put("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
        properties.put("hibernate.show_sql", "true");
        properties.put("hibernate.format_sql", "true");
        properties.put("hibernate.hbm2ddl.auto", "create");
        properties.put("hibernate.naming-strategy", "org.hibernate.cfg.ImprovedNamingStrategy");
        properties.put("hibernate.default_schema", "public");

        logger.info("============================[hibernateJPAProperties: Ends]");
        return properties;
    }

    @Bean
    public JpaTransactionManager jpaTransactionManager() {
        logger.info("============================[jpaTransactionManager: Began]");
        JpaTransactionManager manager = new JpaTransactionManager();
        manager.setEntityManagerFactory(localContainerEntityManagerFactoryBean().getObject());
        logger.info("============================[jpaTransactionManager: Ends]");
        return manager;
    }
}

2) DispatcherServlet:

public class DispatcherServletConifg extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] { JpaHibernateSpringConfig.class };
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[] { WebServletInit.class };
    }

    @Override
    protected String[] getServletMappings() {
        return new String[] { "/" };
    }

3) Historic entity

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "historic_type")
@Table(name = "historic")
public abstract class Historic implements Serializable {

    private static final long serialVersionUID = -802306391915956578L;

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;

    private double open;

    private double high;

    private double low;

    private double close;

    private double volume;

    @Column(name = "adj_close")
    private double adjClose;

    @Column(name = "change_percent")
    private double changePercent;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "from_date")
    private Date fromDate;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "to_date")
    private Date toDate;

    @Enumerated(EnumType.STRING)
    @Column(name = "interval")
    private QuotesInterval interval;

Please take a look at logs and if you need any other information let me know.

Thanks.

I think problem is mysql keyword is being used as column name “interval”
try some other name

we can rename interval field like below

@Enumerated(EnumType.STRING)
@Column(name = "quotesinterval")
private QuotesInterval interval;

OR

any name which matches to your need.

Bottom line is should not use any mysql keywords

I tried that generated sql query as suggested by Ashish turned out that interval was not supported as field type so I changed my field name a little bit and it started working but still not sure if that wasen’t supported. Configuration should have thrown a error

I changed @Enumerated(EnumType.STRING)
@Column(name = “interval”)
private QuotesInterval interval;
to

@Enumerated(EnumType.STRING)
@Column(name = “‘interval'”) //<– here
private QuotesInterval interval;

there is slight tick inside @column() that worked.
Thank you.