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

public class JpaHibernateSpringConfig {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    public DataSource dataSource() {"============================[Data Source Configuration: Began]");
        BasicDataSource ds = new BasicDataSource();
        ds.setPassword("root");"============================[Data Source Configuration: Ends]");
        return ds;

    public LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean() {"============================[LocalContainerEntityManagerFactoryBean: Began]");
        LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
        bean.setJpaProperties(hibernateJPAProperties());"===========================[LocalContainerEntityManagerFactoryBean: Ends]");
        return bean;

    public Properties hibernateJPAProperties() {"============================[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("", "create");
        properties.put("hibernate.naming-strategy", "org.hibernate.cfg.ImprovedNamingStrategy");
        properties.put("hibernate.default_schema", "public");"============================[hibernateJPAProperties: Ends]");
        return properties;

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

2) DispatcherServlet:

public class DispatcherServletConifg extends AbstractAnnotationConfigDispatcherServletInitializer {

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

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

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

3) Historic 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;

    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;

    @Column(name = "from_date")
    private Date fromDate;

    @Column(name = "to_date")
    private Date toDate;

    @Column(name = "interval")
    private QuotesInterval interval;

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


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

we can rename interval field like below

@Column(name = "quotesinterval")
private QuotesInterval interval;


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;

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

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